]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/111445 - simple_iv simplification fault
authorRichard Biener <rguenther@suse.de>
Fri, 20 Oct 2023 13:08:49 +0000 (15:08 +0200)
committerRichard Biener <rguenther@suse.de>
Fri, 21 Jun 2024 09:21:15 +0000 (11:21 +0200)
commitce653fa683643d4e5a7146181954358f1060dfed
tree5f41f4a96f2b8d73177faf1be977d07d0eed8c26
parent20fe647365a922c6dd7a7f283abb99b5588476e8
tree-optimization/111445 - simple_iv simplification fault

The following fixes a missed check in the simple_iv attempt
to simplify (signed T)((unsigned T) base + step) where it
allows a truncating inner conversion leading to wrong code.

PR tree-optimization/111445
* tree-scalar-evolution.c (simple_iv_with_niters):
Add missing check for a sign-conversion.

* gcc.dg/torture/pr111445.c: New testcase.

(cherry picked from commit 9692309ed6b625f0fb358c0e230404b5603f69a6)
gcc/testsuite/gcc.dg/torture/pr111445.c [new file with mode: 0644]
gcc/tree-scalar-evolution.c