https://gcc.gnu.org/g:f286b746394f2a81b10dc910f9526c30dad6faea
commit r17-694-gf286b746394f2a81b10dc910f9526c30dad6faea Author: Daniel Barboza <[email protected]> Date: Sat Jan 17 16:01:48 2026 -0300 fold-const.cc: remove strict_overflow_p from maybe_canonicalize_comparison Remove the strict overflow flag from maybe_canonicalize_comparison functions. All related fold_overflow_warning calls are also removed. gcc/ChangeLog: * fold-const.cc (maybe_canonicalize_comparison_1): Removed strict_overflow_p flag. (maybe_canonicalize_comparison): Removed strict_overflow_p flag and all fold_overflow_warning calls. Diff: --- gcc/fold-const.cc | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/gcc/fold-const.cc b/gcc/fold-const.cc index 9058dfc7a272..c86327988af1 100644 --- a/gcc/fold-const.cc +++ b/gcc/fold-const.cc @@ -9731,14 +9731,11 @@ fold_truth_andor (location_t loc, enum tree_code code, tree type, by changing CODE to reduce the magnitude of constants involved in ARG0 of the comparison. Returns a canonicalized comparison tree if a simplification was - possible, otherwise returns NULL_TREE. - Set *STRICT_OVERFLOW_P to true if the canonicalization is only - valid if signed overflow is undefined. */ + possible, otherwise returns NULL_TREE. */ static tree maybe_canonicalize_comparison_1 (location_t loc, enum tree_code code, tree type, - tree arg0, tree arg1, - bool *strict_overflow_p) + tree arg0, tree arg1) { enum tree_code code0 = TREE_CODE (arg0); tree t, cst0 = NULL_TREE; @@ -9785,7 +9782,6 @@ maybe_canonicalize_comparison_1 (location_t loc, enum tree_code code, tree type, code = GT_EXPR; else return NULL_TREE; - *strict_overflow_p = true; /* Now build the constant reduced in magnitude. But not if that would produce one outside of its types range. */ @@ -9817,29 +9813,16 @@ maybe_canonicalize_comparison (location_t loc, enum tree_code code, tree type, tree arg0, tree arg1) { tree t; - bool strict_overflow_p; - const char * const warnmsg = G_("assuming signed overflow does not occur " - "when reducing constant in comparison"); /* Try canonicalization by simplifying arg0. */ - strict_overflow_p = false; - t = maybe_canonicalize_comparison_1 (loc, code, type, arg0, arg1, - &strict_overflow_p); + t = maybe_canonicalize_comparison_1 (loc, code, type, arg0, arg1); if (t) - { - if (strict_overflow_p) - fold_overflow_warning (warnmsg, WARN_STRICT_OVERFLOW_MAGNITUDE); - return t; - } + return t; /* Try canonicalization by simplifying arg1 using the swapped comparison. */ code = swap_tree_comparison (code); - strict_overflow_p = false; - t = maybe_canonicalize_comparison_1 (loc, code, type, arg1, arg0, - &strict_overflow_p); - if (t && strict_overflow_p) - fold_overflow_warning (warnmsg, WARN_STRICT_OVERFLOW_MAGNITUDE); + t = maybe_canonicalize_comparison_1 (loc, code, type, arg1, arg0); return t; }
