]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Fix miscompilation of gnatbind with profiled bootstrap
authorEric Botcazou <ebotcazou@adacore.com>
Wed, 3 Dec 2025 16:26:49 +0000 (17:26 +0100)
committerEric Botcazou <ebotcazou@adacore.com>
Wed, 3 Dec 2025 16:40:55 +0000 (17:40 +0100)
Boolean types may have precision > 1 so using !undefined_p && !varying_p is
not sufficient for them.

gcc/
PR tree-optimization/122934
* tree-ssa-loop-niter.cc (simplify_using_initial_conditions): Use
singleton_p predicate even with boolean ranges.

gcc/tree-ssa-loop-niter.cc

index f27a9e5cd1132513b1adf194a1552adecac2b863..8aa52dc54b014edd9821798daa1060d273de173c 100644 (file)
@@ -3086,13 +3086,13 @@ simplify_using_initial_conditions (class loop *loop, tree expr)
     return expr;
 
   value_range expr_range (TREE_TYPE (expr));
+  tree val;
   if (TREE_TYPE (expr) == boolean_type_node
       && get_range_query (cfun)->range_on_edge (expr_range,
                                                loop_preheader_edge (loop),
                                                expr)
-      && !expr_range.undefined_p ()
-      && !expr_range.varying_p ())
-    return expr_range.nonzero_p () ? boolean_true_node : boolean_false_node;
+      && expr_range.singleton_p (&val))
+    return val;
 
   backup = expanded = expand_simple_operations (expr);