https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98618
--- Comment #4 from nsz at gcc dot gnu.org --- (In reply to Florian Weimer from comment #1) > Is the test case really valid? It involves an out-of-bounds array access, > after all. sorry you are right the indexes are too far, a better test is long n; struct s { long a[100]; }; extern struct s obj __attribute__((visibility("hidden"))); void foo() { long *a = obj.a; a[n - 0x70000000] = n; a[0x70000000 - n + 99] = n; } (i wanted to have an example with both + and - offset) it compiles to foo: adrp x0, :got:n adrp x2, obj-15032385536 add x2, x2, :lo12:obj-15032385536 adrp x1, obj+15032386328 ldr x0, [x0, #:got_lo12:n] add x1, x1, :lo12:obj+15032386328 ldr x0, [x0] neg x3, x0, lsl 3 str x0, [x2, x0, lsl 3] str x0, [x3, x1] ret