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.