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

Jan Hubicka <hubicka at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |ASSIGNED
           Assignee|unassigned at gcc dot gnu.org      |hubicka at gcc dot 
gnu.org

--- Comment #2 from Jan Hubicka <hubicka at gcc dot gnu.org> ---
OK, this is ordering issue in the localization process: we localize comdat
groups one by one, but we also copy visibilities from functions to thunks (that
is somewhat useless fixup at LTO time).
This patch makes the comdat group localization to happen all at once.

Index: ipa.c
===================================================================
--- ipa.c       (revision 207934)
+++ ipa.c       (working copy)
@@ -970,15 +970,32 @@ function_and_variable_visibility (bool w
          gcc_assert (whole_program || in_lto_p
                      || !TREE_PUBLIC (node->decl));
          node->unique_name = ((node->resolution == LDPR_PREVAILING_DEF_IRONLY
-                                     || node->resolution ==
LDPR_PREVAILING_DEF_IRONLY_EXP)
-                                     && TREE_PUBLIC (node->decl));
+                               || node->unqiue_name
+                               || node->resolution ==
LDPR_PREVAILING_DEF_IRONLY_EXP)
+                               && TREE_PUBLIC (node->decl));
          node->resolution = LDPR_PREVAILING_DEF_IRONLY;
          if (node->same_comdat_group && TREE_PUBLIC (node->decl))
-           /* cgraph_externally_visible_p has already checked all other nodes
-              in the group and they will all be made local.  We need to
-              dissolve the group at once so that the predicate does not
-              segfault though. */
-           symtab_dissolve_same_comdat_group_list (node);
+           {
+             symtab_node *next = node;
+
+             /* Set all members of comdat group local.  */
+             if (node->same_comdat_group)
+               for (next = node->same_comdat_group;
+                    next != node;
+                    next = next->same_comdat_group)
+               {
+                 symtab_make_decl_local (next->decl);
+                 next->unique_name = ((next->resolution ==
LDPR_PREVAILING_DEF_IRONLY
+                                       || next->unqiue_name
+                                       || next->resolution ==
LDPR_PREVAILING_DEF_IRONLY_EXP)
+                                       && TREE_PUBLIC (next->decl));
+               }
+             /* cgraph_externally_visible_p has already checked all other
nodes
+                in the group and they will all be made local.  We need to
+                dissolve the group at once so that the predicate does not
+                segfault though. */
+             symtab_dissolve_same_comdat_group_list (node);
+           }
          symtab_make_decl_local (node->decl);
        }

Reply via email to