This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/49568] [4.7 regression] g++.dg/torture/pr41257-2.C FAILs to link on Tru64 UNIX


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

--- Comment #6 from Jan Hubicka <hubicka at ucw dot cz> 2011-07-01 09:30:41 UTC ---
> This is Tru64 UNIX with ECOFF, no named sections, no COMDAT groups.
Yep, I know, but the question is how absence of COMDAT groups changes behaviour
of thunks.

The problem here is that the thunks are
!cgraph_can_remove_if_no_direct_calls_and_refs_p
and thus we don't optimize them out.
The reason is the test:
2902      if (node->local.externally_visible
2903          && (!DECL_COMDAT (node->decl)
2904              || cgraph_used_from_object_file_p (node)))
2905        return false;

the decl is not comdat, just weak and thus we think we must keep it in program.

The declaration of the destructor itself do have COMDAT flag.
The following patch should fix the problem:
Index: ipa.c
===================================================================
--- ipa.c       (revision 175748)
+++ ipa.c       (working copy)
@@ -871,9 +871,9 @@ function_and_variable_visibility (bool w

             We also need to arrange the thunk into the same comdat group as
             the function it reffers to.  */
+          DECL_COMDAT (node->decl) = DECL_COMDAT (decl_node->decl);
          if (DECL_ONE_ONLY (decl_node->decl))
            {
-             DECL_COMDAT (node->decl) = DECL_COMDAT (decl_node->decl);
              DECL_COMDAT_GROUP (node->decl) = DECL_COMDAT_GROUP
(decl_node->decl);
              if (DECL_ONE_ONLY (decl_node->decl) && !node->same_comdat_group)
                {


Jason, the whole code copying visibilities to thunk decls is just a hack.  Do
you think
you can make C++ FE to put proper visibility flags on thunks and same body
aliases?

Honza


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]