https://gcc.gnu.org/bugzilla/show_bug.cgi?id=126459
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
I had
--- a/gcc/match.pd 2026-10-03 21:28:13.092320517 +0200
+++ b/gcc/match.pd 2026-10-06 21:36:22.644983570 +0200
@@ -5369,8 +5369,11 @@ DEFINE_INT_AND_FLOAT_ROUND_FN (RINT)
tree cst1 = uniform_integer_cst_p (@1);
tree cst2 = uniform_integer_cst_p (@3);
tree cst3 = uniform_integer_cst_p (@4);
+ wi::overflow_type ovf;
}
- (if (wi::to_wide (cst1) + wi::to_wide (cst2) == wi::to_wide (cst3))
+ (if (wi::add (wi::to_wide (cst1), wi::to_wide (cst2),
+ TYPE_SIGN (TREE_TYPE (cst1)), &ovf) == wi::to_wide (cst3)
+ && (!ovf || TYPE_OVERFLOW_WRAPS (TREE_TYPE (cst1))))
@2))))
/* Simplifications of shift and rotates. */
for this.