[Bug tree-optimization/127130] [14/15/16/17 Regression] wrong code at -O{2,3} on x86_64-linux-gnu
cvs-commit at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Tue Sep 1 14:06:33 GMT 2026
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=127130
--- Comment #7 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Richard Biener <rguenth@gcc.gnu.org>:
https://gcc.gnu.org/g:7686bcbb2b7b08688008a6a0e29e6561af1a9a98
commit r17-3818-g7686bcbb2b7b08688008a6a0e29e6561af1a9a98
Author: Richard Biener <rguenther@suse.de>
Date: Tue Sep 1 15:09:42 2026 +0200
tree-optimization/127130 - avoid peeled CHREC with UB
The following properly guards the peeled CHREC optimization
when we are analyzing a CHREC with non-wrapping overflow.
Otherwise we can introduce UB which can manifest via
infer_loop_bounds_from_signedness and thus wrong niter analysis.
This regresses gcc.dg/gomp/static-chunk-size-one.c because we
can no longer replace a signed IV via a peeled chrec and lack
other means.
PR tree-optimization/127130
* tree-scalar-evolution.cc (simplify_peeled_chrec):
Guard against signed integer overflow UB.
* gcc.dg/torture/pr127130-1.c: New testcase.
* gcc.dg/torture/pr127130-2.c: Likewise.
* gcc.dg/gomp/static-chunk-size-one.c: Adjust.
More information about the Gcc-bugs
mailing list