[Bug other/107353] [13 regression] Numerous ICEs after r13-3416-g1d561e1851c466

iains at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 22 11:17:39 GMT 2022


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

--- Comment #4 from Iain Sandoe <iains at gcc dot gnu.org> ---
Emulated TLS targets can test targetm.have_tls.

The patch below fixes the fails on Fortran for x86_64-darwin, libgomp in test
now.

I do not really like that it means pulling in the whole of target.h, and
imagine that this will not fix the powerpc64le-linux-gnu cases?

The TLS varieties are "ELF" (AFAIU).. so this would not fix things if/when I
implement native TLS on Darwin (since that has Mach-O semantics for TLS).

so, perhaps there's a better test (or we should make the targetm test more
fine-grained).  In any event we should not test things that pertain to the
platform in the inner loop - but either punt on the whole opt (or choose a
different flavour) for other targets.


diff --git a/gcc/ipa-visibility.cc b/gcc/ipa-visibility.cc
index 3ed2b7cf679..acea49f8b1f 100644
--- a/gcc/ipa-visibility.cc
+++ b/gcc/ipa-visibility.cc
@@ -86,6 +86,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "ipa-utils.h"
 #include "stringpool.h"
 #include "attribs.h"
+#include "target.h"

 /* Return true when NODE cannot be local. Worker for cgraph_local_node_p.  */

@@ -873,7 +874,7 @@ function_and_variable_visibility (bool whole_program)
        }
     }

-  if (symtab->state >= IPA_SSA)
+  if (symtab->state >= IPA_SSA && targetm.have_tls)
     {
       FOR_EACH_VARIABLE (vnode)
        {


More information about the Gcc-bugs mailing list