Re: [C++ Patch] PR 71464 ("[6/7/8 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault")
OK. On Sat, Mar 3, 2018 at 4:50 AM, Paolo Carliniwrote: > Hi, > > On 03/03/2018 06:13, Jason Merrill wrote: >> >> On Fri, Mar 2, 2018 at 4:02 PM, Paolo Carlini >> wrote: >>> >>> this error recovery ICE happens only with -Os and is just a P5 - on the >>> other hand I would argue the reproducer isn't that exotic! - but seems >>> fixable easily and safely: cdtor_comdat_group immediately calls >>> DECL_ASSEMBLER_NAME on both arguments and of course crashes if they are >>> null. Tested x86_64-linux. >> >> It would make more sense to me to do this check and return right after >> populate_clone_array. > > Oh nice. Then, given that the existing 'if (fns[0] && ...' looked a bit > weird to me, to be super safe I also ran the the testsuite with 'gcc_assert > (fns[0] && fns[1]);' and everything went well, it only triggered for the new > testcase. Is the below OK? > > Thanks, > Paolo. > > //
Re: [C++ Patch] PR 71464 ("[6/7/8 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault")
Hi, On 03/03/2018 06:13, Jason Merrill wrote: On Fri, Mar 2, 2018 at 4:02 PM, Paolo Carliniwrote: this error recovery ICE happens only with -Os and is just a P5 - on the other hand I would argue the reproducer isn't that exotic! - but seems fixable easily and safely: cdtor_comdat_group immediately calls DECL_ASSEMBLER_NAME on both arguments and of course crashes if they are null. Tested x86_64-linux. It would make more sense to me to do this check and return right after populate_clone_array. Oh nice. Then, given that the existing 'if (fns[0] && ...' looked a bit weird to me, to be super safe I also ran the the testsuite with 'gcc_assert (fns[0] && fns[1]);' and everything went well, it only triggered for the new testcase. Is the below OK? Thanks, Paolo. // Index: cp/optimize.c === --- cp/optimize.c (revision 258165) +++ cp/optimize.c (working copy) @@ -261,8 +261,12 @@ maybe_thunk_body (tree fn, bool force) populate_clone_array (fn, fns); + /* Can happen during error recovery (c++/71464). */ + if (!fns[0] || !fns[1]) +return 0; + /* Don't use thunks if the base clone omits inherited parameters. */ - if (fns[0] && ctor_omit_inherited_parms (fns[0])) + if (ctor_omit_inherited_parms (fns[0])) return 0; DECL_ABSTRACT_P (fn) = false; Index: testsuite/g++.dg/torture/pr71464.C === --- testsuite/g++.dg/torture/pr71464.C (nonexistent) +++ testsuite/g++.dg/torture/pr71464.C (working copy) @@ -0,0 +1,7 @@ +struct A {}; + +struct B : virtual A +{ + B () {}; + B () {}; // { dg-error "cannot be overloaded" } +};
Re: [C++ Patch] PR 71464 ("[6/7/8 Regression] ICE on invalid code (with redeclared constructor) at -Os: Segmentation fault")
On Fri, Mar 2, 2018 at 4:02 PM, Paolo Carliniwrote: > this error recovery ICE happens only with -Os and is just a P5 - on the > other hand I would argue the reproducer isn't that exotic! - but seems > fixable easily and safely: cdtor_comdat_group immediately calls > DECL_ASSEMBLER_NAME on both arguments and of course crashes if they are > null. Tested x86_64-linux. It would make more sense to me to do this check and return right after populate_clone_array. Jason