https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109035
chenglulu <chenglulu at loongson dot cn> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |chenglulu at loongson dot cn --- Comment #2 from chenglulu <chenglulu at loongson dot cn> --- I think this is most likely caused by the implementation of the public code. If the immediate value is set to be large enough, such as 0xfffffff, aarch64 also has the same problem. $ cat t.c int test(int x) { char buf[0xfffffff]; return buf[x]; } $ ./cc1 t.c -o - -O2 2>/dev/null | grep test -A20 test: .LFB0: .cfi_startproc mov x12, 16 mov x2, 16 movk x12, 0x1000, lsl 16 sub sp, sp, x12 .cfi_def_cfa_offset 268435472 movk x2, 0x1000, lsl 16 mov x1, -268435456 add x1, x2, x1 add x1, sp, x1 str x1, [sp, 8] ldrb w0, [x1, w0, sxtw] add sp, sp, x12 .cfi_def_cfa_offset 0 ret The "str x1, [sp, 8]" instruction also has the same problem.