[Bug ipa/62051] [4.9/5/6 Regression] Undefined reference to vtable with -O2 and -fdevirtualize-speculatively

jason at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Fri Jan 22 21:43:00 GMT 2016


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

--- Comment #14 from Jason Merrill <jason at gcc dot gnu.org> ---
(In reply to Jan Hubicka from comment #13)
> 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.

Right.

> 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++.

Hmm?  This shouldn't affect libstdc++ at all; it doesn't set visibility on
individual member functions, only on whole namespaces.  This should only affect
code that plays these kinds of partial export games.

> It still seem to me that the the testcase is sort of invalid because it
> provide inline body for the dtor.

Agreed, but if it were out-of-line we'd have the same problem with devirt
trying to call the dtor directly.

> Can we think of better solution (perhaps
> validating comdats before using them and checking if symbols they refer to
> are referable)?

Since the effect should already be well targeted, I don't think we need to work
that hard.


More information about the Gcc-bugs mailing list