]> git.ipfire.org Git - thirdparty/gcc.git/commit
Fix off by one in range_from_loop_direction.
authorAndrew MacLeod <amacleod@redhat.com>
Tue, 30 Sep 2025 19:59:38 +0000 (15:59 -0400)
committerAndrew MacLeod <amacleod@redhat.com>
Wed, 1 Oct 2025 14:24:37 +0000 (10:24 -0400)
commit1e13fb44f1474b7d57e7144d3fff38e9c769b92d
treed6c2781c6748c149eb335dd832180bcb76528fbe
parentd5c5c1a136142e3cffe3e30c333c84c153fcdb5d
Fix off by one in range_from_loop_direction.

When bounds_of_var_in_loop was converted to range_from_loop_direction,
the final check returned FALSE when the beginning and end bounds were
the same...  The new code was using wi::gt_p, when it should have been
wi::ge_p when checking for the fail condition.

PR tree-optimization/120560
gcc/
* vr-values.cc (range_from_loop_direction): Use wi::ge_p rather
than wi::gt_p.

gcc/testsuite/
* gcc.dg/pr120560.c: New.
gcc/testsuite/gcc.dg/pr120560.c [new file with mode: 0644]
gcc/vr-values.cc