[Bug ipa/99466] internal compiler error: in function_and_variable_visibility, at ipa-visibility.c:795

ibuclaw at gdcproject dot org gcc-bugzilla@gcc.gnu.org
Mon Mar 8 14:19:59 GMT 2021


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

--- Comment #2 from Iain Buclaw <ibuclaw at gdcproject dot org> ---
(In reply to Martin Liška from comment #1)
> What compiler options do you use?
No compiler options are necessary to reproduce the ICE.  The symbol it fails on
is ___emutls_t.tlsvar.

Having a look at where this variable is created, it looks like TREE_PUBLIC is
copied for DECL_ONE_ONLY symbols, but not DECL_WEAK.

--- a/gcc/tree-emutls.c
+++ b/gcc/tree-emutls.c
@@ -242,16 +242,18 @@ get_emutls_init_templ_addr (tree decl)
   DECL_PRESERVE_P (to) = DECL_PRESERVE_P (decl);

   DECL_WEAK (to) = DECL_WEAK (decl);
-  if (DECL_ONE_ONLY (decl))
+  if (DECL_ONE_ONLY (decl) || DECL_WEAK (decl))
     {
       TREE_STATIC (to) = TREE_STATIC (decl);
       TREE_PUBLIC (to) = TREE_PUBLIC (decl);
       DECL_VISIBILITY (to) = DECL_VISIBILITY (decl);
-      make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
     }
   else
     TREE_STATIC (to) = 1;

+  if (DECL_ONE_ONLY (decl))
+    make_decl_one_only (to, DECL_ASSEMBLER_NAME (to));
+
   DECL_VISIBILITY_SPECIFIED (to) = DECL_VISIBILITY_SPECIFIED (decl);
   DECL_INITIAL (to) = DECL_INITIAL (decl);
   DECL_INITIAL (decl) = NULL;


More information about the Gcc-bugs mailing list