It occurs to me this was introduced in gcc14.. do we want to port this
back to gcc 15 and 14?
The same patch should apply... I can run it thru the usual things and
commit it to those branches if you want.
Andrew
On 10/1/25 10:25, Andrew MacLeod wrote:
When bounds_of_var_in_loop was converted to range _of_var_in_loop,
quite a bit of code was refactored.
The final check which is now in range_from_loop_direction, use to
return FALSE when the beginning and end bounds were the same... The
new code was converted from trees into ranges, and the check was
changed to see if the beginning and end bounds were behaving properly,
and if not, there was a potential overflow and we abort.
The old code also aborted if the upper and lower bounds were the same,
but when refactored, the logic was reversed and the conditions were
not changed. THis allowed bounds that were the same to still generate
a range, which would be incorrect. This testcase demonstrates that
where we generate a range of [2,2] for the loop when we should not.
The attached patch fixes this by using wi::ge_p instead of wi::gt_p
for the fail condition, and returns us back to the expected
behaviour. As a side bonus, it also now fixes this testcase in the
JIT compiler:
> FAIL: test-ggc-bugfix.c.exe iteration 1 of 5: verify_code: result is
NULL
> FAIL: test-ggc-bugfix.c.exe killed: SIGABRT SIGABRT
This testcase now passes in the JIT suite.
Bootstraps on build-x86_64-pc-linux-gnu with no new regressions, and
fixes that jit regression as well. Pushed.
Andrew