https://gcc.gnu.org/bugzilla/show_bug.cgi?id=128019

Wang Lei <MrEven132 at outlook dot com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Target|AArch64, x86-64             |AArch64

--- Comment #1 from Wang Lei <MrEven132 at outlook dot com> ---
The reported remainder symptom also reproduces on x86_64-pc-linux-gnu with GCC
17.0.0 20261003 (experimental) and GDB 17.2. Using the same sources, build
commands and breakpoints, both signed _BitInt(7) and _BitInt(8) remainders are
-1 at -O0 but 0 at -O2, as on AArch64.

The active DW_AT_location list entries for remainder at the -O2 sink
breakpoints are:

  _BitInt(7), test_bitint_signed, [0x401153, 0x401169):
    DW_OP_breg0 (rax): 0; DW_OP_const1s: -8; DW_OP_shl; DW_OP_lit1; DW_OP_shl;
DW_OP_lit1; DW_OP_shra; DW_OP_stack_value

  _BitInt(8), test_bitint8, [0x401159, 0x40116a):
    DW_OP_breg0 (rax): 0; DW_OP_const1s: -8; DW_OP_shl; DW_OP_stack_value

GDB warns "left shift count is negative" for both expressions. The AArch64
expressions instead recompute the remainder with DW_OP_div, DW_OP_mul and
DW_OP_minus. Thus the visible symptom is the same, but these expressions do not
establish the same underlying defect.

Reply via email to