http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54457
Bug #: 54457 Summary: [x32] Fail to combine 64bit index + constant Classification: Unclassified Product: gcc Version: 4.8.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: ubiz...@gmail.com [hjl@gnu-ivb-1 pr54445]$ cat z.i extern char array[40]; char foo (long long int position) { return array[position + 1]; } [hjl@gnu-ivb-1 pr54445]$ /export/build/gnu/gcc-x32/build-x86_64-linux/prev-gcc/xgcc -B/export/build/gnu/gcc-x32/build-x86_64-linux/prev-gcc/ -Wall -O2 -std=gnu11 -mx32 -S z.i -da [hjl@gnu-ivb-1 pr54445]$ cat z.s .file "z.i" .text .p2align 4,,15 .globl foo .type foo, @function foo: .LFB0: .cfi_startproc addq $1, %rdi movzbl array(%edi), %eax ret .cfi_endproc .LFE0: .size foo, .-foo .ident "GCC: (GNU) 4.8.0 20120901 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-ivb-1 pr54445]$ combine fails on: Trying 6 -> 8: Failed to match this instruction: (set (reg:QI 66) (mem/j:QI (plus:SI (subreg:SI (plus:DI (reg/v:DI 62 [ position ]) (const_int 1 [0x1])) 0) (symbol_ref:SI ("array") [flags 0x40] <var_decl 0x7ffff19ad260 arra y>)) [0 array S1 A8])) This should be a valid address.