]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/121370 - avoid UB in building a CHREC
authorRichard Biener <rguenther@suse.de>
Tue, 5 Aug 2025 06:59:18 +0000 (08:59 +0200)
committerRichard Biener <rguenth@gcc.gnu.org>
Tue, 5 Aug 2025 11:03:50 +0000 (13:03 +0200)
commitafafae097232e700bb7a74a453a048b83ebefccd
tree4454abab4eb4451c7fbf0646014bc3807c443418
parentbc97874bec823e08def7c6acd04c26e2174ca0b3
tree-optimization/121370 - avoid UB in building a CHREC

When there is obvious UB involved in the process of re-associating
a series of IV increments to build up a CHREC, fail.  This catches
a few degenerate cases where SCEV introduces UB with its inherent
re-associating of IV increments.

PR tree-optimization/121370
* tree-scalar-evolution.cc (scev_dfs::add_to_evolution_1):
Avoid UB integer overflow in accumulating CHREC_RIGHT.

* gcc.dg/torture/pr121370.c: New testcase.
gcc/testsuite/gcc.dg/torture/pr121370.c [new file with mode: 0644]
gcc/tree-scalar-evolution.cc