OK.
On Tue, Mar 7, 2017 at 2:03 PM, Jakub Jelinek <ja...@redhat.com> wrote: > Hi! > > Apparently in error recovery, populate_clone_array can't return fns > with all NULLs. maybe_thunk_body used to handle that fine, but > the newly added ctor_omit_inherited_parms call ICEs. > > Fixed thusly, bootstrapped/regtested on x86_64-linux and i686-linux, ok for > trunk? > > 2017-03-07 Jakub Jelinek <ja...@redhat.com> > > PR c++/79899 > * optimize.c (maybe_thunk_body): Don't ICE if fns[0] is NULL. > Use XALLOCAVEC macro. > > * g++.dg/other/friend7.C: New test. > > --- gcc/cp/optimize.c.jj 2017-02-04 08:43:15.000000000 +0100 > +++ gcc/cp/optimize.c 2017-03-07 13:21:52.280184213 +0100 > @@ -262,7 +262,7 @@ maybe_thunk_body (tree fn, bool force) > populate_clone_array (fn, fns); > > /* Don't use thunks if the base clone omits inherited parameters. */ > - if (ctor_omit_inherited_parms (fns[0])) > + if (fns[0] && ctor_omit_inherited_parms (fns[0])) > return 0; > > DECL_ABSTRACT_P (fn) = false; > @@ -324,7 +324,7 @@ maybe_thunk_body (tree fn, bool force) > if (length > max_parms) > max_parms = length; > } > - args = (tree *) alloca (max_parms * sizeof (tree)); > + args = XALLOCAVEC (tree, max_parms); > > /* We know that any clones immediately follow FN in TYPE_METHODS. */ > FOR_EACH_CLONE (clone, fn) > --- gcc/testsuite/g++.dg/other/friend7.C.jj 2017-03-07 13:22:44.814487619 > +0100 > +++ gcc/testsuite/g++.dg/other/friend7.C 2017-03-07 13:23:16.793063590 > +0100 > @@ -0,0 +1,9 @@ > +// PR c++/79899 > + > +// { dg-do compile } > +// { dg-options "-Os" } > + > +struct A > +{ > + friend A::~A() {} // { dg-error "implicitly friends of their class" } > +}; > > Jakub