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

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The problem is that varasm.c uses TREE_PUBLIC on all decls, but it now means
something different on LABEL_DECLs.  So either we tweak it:
--- gcc/varasm.c.jj     2016-10-09 13:19:09.000000000 +0200
+++ gcc/varasm.c        2016-10-12 09:57:21.499076633 +0200
@@ -6847,7 +6847,7 @@ default_binds_local_p_3 (const_tree exp,
                         bool extern_protected_data, bool common_local_p)
 {
   /* A non-decl is an entry in the constant pool.  */
-  if (!DECL_P (exp))
+  if (!DECL_P (exp) || TREE_CODE (exp) == LABEL_DECL)
     return true;

   /* Weakrefs may not bind locally, even though the weakref itself is always
@@ -6856,8 +6856,8 @@ default_binds_local_p_3 (const_tree exp,
      FIXME: We can resolve the weakref case more curefuly by looking at the
      weakref alias.  */
   if (lookup_attribute ("weakref", DECL_ATTRIBUTES (exp))
-          || (TREE_CODE (exp) == FUNCTION_DECL
-              && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp))))
+      || (TREE_CODE (exp) == FUNCTION_DECL
+         && lookup_attribute ("ifunc", DECL_ATTRIBUTES (exp))))
     return false;

   /* Static variables are always local.  */
@@ -6972,7 +6972,7 @@ decl_binds_to_current_def_p (const_tree
   gcc_assert (DECL_P (decl));
   if (!targetm.binds_local_p (decl))
     return false;
-  if (!TREE_PUBLIC (decl))
+  if (!TREE_PUBLIC (decl) || TREE_CODE (decl) == LABEL_DECL)
     return true;

   /* When resolution is available, just use it.  */

and wait for other spots that should change, or we choose a different flag.
I think my preference would be to try TREE_PRIVATE bit for it instead.

Reply via email to