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

--- Comment #7 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
--- gcc/gimplify.cc.jj  2025-03-31 12:53:44.853727077 +0200
+++ gcc/gimplify.cc     2025-03-31 17:05:40.854893880 +0200
@@ -4508,6 +4508,21 @@ gimplify_variant_call_expr (tree expr, f
 }


+/* Helper function for gimplify_call_expr, called via walk_tree.
+   Find used user labels.  */
+
+static tree
+find_used_user_labels (tree *tp, int *, void *)
+{
+  if (TREE_CODE (*tp) == LABEL_EXPR
+      && !DECL_ARTIFICIAL (LABEL_EXPR_LABEL (*tp))
+      && DECL_NAME (LABEL_EXPR_LABEL (*tp))
+      && TREE_USED (LABEL_EXPR_LABEL (*tp)))
+    return *tp;
+  return NULL_TREE;
+}
+
+
 /* Gimplify the CALL_EXPR node *EXPR_P into the GIMPLE sequence PRE_P.
    WANT_VALUE is true if the result of the call is desired.  */

@@ -4568,8 +4583,14 @@ gimplify_call_expr (tree *expr_p, gimple
                                                   fndecl, 0));
                  return GS_OK;
                }
-             /* If not optimizing, ignore the assumptions.  */
-             if (!optimize || seen_error ())
+             /* If not optimizing, ignore the assumptions unless there
+                are used user labels in it.  */
+             if ((!optimize
+                  && !walk_tree_without_duplicates (&CALL_EXPR_ARG (*expr_p,
+                                                                    0),
+                                                    find_used_user_labels,
+                                                    NULL))
+                 || seen_error ())
                {
                  *expr_p = NULL_TREE;
                  return GS_ALL_DONE;
fixes the ICE during cfg pass ICE, but it then ICEs during IRA:
error: wrong number of branch edges after unconditional jump in bb 2.

So guess we'll need to search for &&label in the IL outside of the assume
operands
referencing labels inside of those operands (and maybe vice versa) during the
lowering pass.

Reply via email to