On Dec  7, 2023, Thomas Schwinge <tho...@codesourcery.com> wrote:

> Thank you for looking into this so promptly!

You're welcome ;-)


>     during IPA pass: emutls
>     [...]/source-gcc/gcc/testsuite/c-c++-common/strub-unsupported-3.c:18:1: 
> internal compiler error: in verify_curr_properties, at passes.cc:2198

Aah, this smells a lot like the issue that François-Xavier reported,
that the following patch is expected to fix.  I'm still regstrapping it
on x86_64-linux-gnu, after checking that it addressed the symptom on a
cross compiler to the target for which it had originally been reported.
Ok to install, once you confirm that it cures these ICEs?


strub: skip emutls after strubm errors

The emutls pass requires PROP_ssa, but if the strubm pass (or any
other pre-SSA pass) issues errors, all of the build_ssa_passes are
skipped, so the property is not set, but emutls still attempts to run,
on targets that use it, despite earlier errors, so it hits the
unsatisfied requirement.

Adjust emutls to be skipped in case of earlier errors.


for  gcc/ChangeLog

        * tree-emutls.cc: Include diagnostic-core.h.
        (pass_ipa_lower_emutls::gate): Skip if errors were seen.
---
 gcc/tree-emutls.cc |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/gcc/tree-emutls.cc b/gcc/tree-emutls.cc
index 5dca5a8291356..38de202717a1a 100644
--- a/gcc/tree-emutls.cc
+++ b/gcc/tree-emutls.cc
@@ -35,6 +35,7 @@ along with GCC; see the file COPYING3.  If not see
 #include "langhooks.h"
 #include "tree-iterator.h"
 #include "gimplify.h"
+#include "diagnostic-core.h" /* for seen_error */
 
 /* Whenever a target does not support thread-local storage (TLS) natively,
    we can emulate it with some run-time support in libgcc.  This will in
@@ -841,7 +842,7 @@ public:
   bool gate (function *) final override
     {
       /* If the target supports TLS natively, we need do nothing here.  */
-      return !targetm.have_tls;
+      return !targetm.have_tls && !seen_error ();
     }
 
   unsigned int execute (function *) final override


-- 
Alexandre Oliva, happy hacker            https://FSFLA.org/blogs/lxo/
   Free Software Activist                   GNU Toolchain Engineer
More tolerance and less prejudice are key for inclusion and diversity
Excluding neuro-others for not behaving ""normal"" is *not* inclusive

Reply via email to