https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128020
--- Comment #2 from Wang Lei <MrEven132 at outlook dot com> ---
My previous comment was intended for a different issue and was posted here by
mistake. Please disregard it.
Also reproduced on x86_64-pc-linux-gnu with GCC 17.0.0 20261003 (experimental)
and GDB 17.2, using the same source and compiler options as in the report.
At case.c:16 in foo(1), GDB prints i = 0 with loop unrolling enabled, while EAX
is 1. Adding -fno-unroll-loops makes GDB print i = 1 at the same source line,
matching the AArch64 behavior.
The active DW_AT_location list entries for i at case.c:16 are:
With unrolling (breakpoint PC 0x401187):
[0x401137, 0x401188): DW_OP_lit0; DW_OP_stack_value
With -fno-unroll-loops (breakpoint PC 0x401147):
[0x401140, 0x401148): DW_OP_reg0 (rax)