https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62051

--- Comment #13 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
Created attachment 37388
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=37388&action=edit
patch

Hi,
this patch adds the logic to gimple-fold.c which makes the offending dtor
non-refeable.  It is bit uglier than I hoped for.  The reason is that the dtor
itself is COMDAT so it seems perfectly OK to refer it since we can provide the
body, but the body itself refers to vtable that is not output in the unit.

The patch simply prohibits references to all COMDAT and EXTERN methods and
vtables of types with visibility attributes which will prevent optimizing of
many inlines i.e. in libstdc++.

It still seem to me that the the testcase is sort of invalid because it provide
inline body for the dtor. Can we think of better solution (perhaps validating
comdats before using them and checking if symbols they refer to are referable)?

Reply via email to