[Bug c/125671] ICE: SIGSEGV in contains_struct_check (tree.h:3937) with __builtin_stdc_rotate_left()

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Jun 9 02:51:13 GMT 2026


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

--- Comment #2 from Drea Pinski <pinskia at gcc dot gnu.org> ---
This fixes the issue:
```
diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc
index 7f49126c95a..99b685e023c 100644
--- a/gcc/fold-const.cc
+++ b/gcc/fold-const.cc
@@ -14789,6 +14789,10 @@ tree_invalid_nonnegative_p (tree t, int depth)
        tree temp = TARGET_EXPR_SLOT (t);
        t = TARGET_EXPR_INITIAL (t);

+       /* During gimplification, TARGET_EXPR_INITIAL can be null. */
+       if (t == NULL_TREE)
+         return false;
+
        /* If the initializer is non-void, then it's a normal expression
           that will be assigned to the slot.  */
        if (!VOID_TYPE_P (TREE_TYPE (t)))

```


If I get a chance I can try to bootstrap/test it.


More information about the Gcc-bugs mailing list