From: Eric Botcazou Date: Wed, 3 Dec 2025 16:26:49 +0000 (+0100) Subject: Fix miscompilation of gnatbind with profiled bootstrap X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=f5978fc4f173d04dd5c48318cdff107cc4fabc76;p=thirdparty%2Fgcc.git Fix miscompilation of gnatbind with profiled bootstrap 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. --- diff --git a/gcc/tree-ssa-loop-niter.cc b/gcc/tree-ssa-loop-niter.cc index f27a9e5cd11..8aa52dc54b0 100644 --- a/gcc/tree-ssa-loop-niter.cc +++ b/gcc/tree-ssa-loop-niter.cc @@ -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);