https://gcc.gnu.org/bugzilla/show_bug.cgi?id=61998
--- Comment #5 from Markus Trippelsdorf <trippels at gcc dot gnu.org> --- (In reply to Jan Hubicka from comment #4) > I suppose VECtors do not like to grow to 0 size. THe following patch fixes > the ICE, does it also fixe you real testcases? > Index: ipa-devirt.c > =================================================================== > --- ipa-devirt.c (revision 214303) > +++ ipa-devirt.c (working copy) > @@ -3822,6 +3845,9 @@ ipa_devirt (void) > int nmultiple = 0, noverwritable = 0, ndevirtualized = 0, nnotdefined = 0; > int nwrong = 0, nok = 0, nexternal = 0, nartificial = 0; > > + if (!odr_types.length ()) > + return 0; > + > /* We can output -Wsuggest-final-methods and -Wsuggest-final-types > warnings. > This is implemented by setting up final_warning_records that are > updated > by get_polymorphic_call_targets. That patch would crash the minimal and empty testcase even without -Wsuggest-final-types. You probably mean: diff --git a/gcc/ipa-devirt.c b/gcc/ipa-devirt.c index 2e74ca61c508..acfd5d2fdede 100644 --- a/gcc/ipa-devirt.c +++ b/gcc/ipa-devirt.c @@ -3822,6 +3822,9 @@ ipa_devirt (void) int nmultiple = 0, noverwritable = 0, ndevirtualized = 0, nnotdefined = 0; int nwrong = 0, nok = 0, nexternal = 0, nartificial = 0; + if (!odr_types_ptr) + return 0; + /* We can output -Wsuggest-final-methods and -Wsuggest-final-types warnings. This is implemented by setting up final_warning_records that are updated by get_polymorphic_call_targets.