http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58678

--- Comment #4 from Jan Hubicka <hubicka at ucw dot cz> ---
Actually ipa-devirt has a code that is supposed to not make devirt happen in
this case - I will check out why it doesn't here.

But I think it is KDE's bug here.  You have library with -fvisibility=hidden
and the class has no visibility attributes attached, so it is fully captured in
the library and you should not include it from file that is not part of the
library.

Not exactly C++ standard, since it does not speak about visibilities, but it is
how we figure out what we can reffer:

static bool
can_refer_decl_in_current_unit_p (tree decl, tree from_decl)

which has clause

  /* We are folding reference from external vtable.  The vtable may reffer
     to a symbol keyed to other compilation unit.  The other compilation
     unit may be in separate DSO and the symbol may be hidden.  */
  if (DECL_VISIBILITY_SPECIFIED (decl)
      && DECL_EXTERNAL (decl)
      && (!(snode = symtab_get_node (decl)) ||
!snode->symbol.in_other_partition))
    return false;


that is supposed to catch cases where user specifies visibilities.  It won't
catch
this case because command line option is used.

I am adding Jason into CC, perhaps we need to revisit logic above.
I will also check why the devirtualization survive - it should not since it
seems
useless.

Honza

Reply via email to