[Bug lto/50430] Constructors of static external vars are throwed away leading to missed optimizations (and ipa-cp ICE).

hubicka at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Sep 22 14:44:00 GMT 2011


--- Comment #3 from Jan Hubicka <hubicka at gcc dot gnu.org> 2011-09-22 14:20:07 UTC ---
Created attachment 25340
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25340
reduced testcase

This is somewhat reduced testcase.  The problem can be a bit illustrated on C.

We have something like

extern vtable[]={vtable2}

where vtable2 sits in other unit and is static.  We however know the
constructor and it is
extern static vtable2[]={function_ptr};

now we can fold vtable[0] to the external vtable2 that we can not reffer in
code, but still can fold references into it into function_ptr.

now with LTO we decide to not stream vtable initializer and replace it by
error_mark losing the knowledge.  This is an regression to 4.6 even though it
is not too important one.

More information about the Gcc-bugs mailing list