]> git.ipfire.org Git - thirdparty/gcc.git/commit
Add testcase for bogus Warray-bounds warning dealing with __builtin_unreachable ...
authorAndrew Pinski <quic_apinski@quicinc.com>
Sat, 5 Apr 2025 11:47:59 +0000 (04:47 -0700)
committerAndrew Pinski <quic_apinski@quicinc.com>
Mon, 28 Apr 2025 17:14:13 +0000 (10:14 -0700)
commit07a14a490b8f57dfe2a5b853fb4b88e9e124a92b
tree9974d0468fbbf614072c989d3cc8dd90323e6ef9
parentbeced835afa3908aa94550d2ca5ee3879a620adb
Add testcase for bogus Warray-bounds warning dealing with __builtin_unreachable [PR100038]

After EVRP was switched to the ranger (r12-2305-g398572c1544d8b), we are better handling the case
where __builtin_unreachable comes after a loop. Instead of removing __builtin_unreachable and having
the loop become an infinite one; it is kept around longer and allows GCC to unroll the loop 2 times instead
of 3 times. When GCC unrolled the loop 3 times, GCC would produce a bogus Warray-bounds warning for the 3rd
iteration.
This adds the testcase to make sure we don't regress on this case. It is originally extracted from LLVM source
code too.

PR tree-optimization/100038

gcc/testsuite/ChangeLog:

* g++.dg/tree-ssa/pr100038.C: New test.

Signed-off-by: Andrew Pinski <quic_apinski@quicinc.com>
gcc/testsuite/g++.dg/tree-ssa/pr100038.C [new file with mode: 0644]