http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52208
Bug #: 52208 Summary: [4.7 Regression] Useless store Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: hjl.to...@gmail.com CC: ubiz...@gmail.com Target: x86_64 [hjl@gnu-6 pr52146]$ cat a.i int test5() { int* apic_tpr_addr = (int *)0xfee00080; return *apic_tpr_addr + 5; } [hjl@gnu-6 pr52146]$ gcc -S -O a.i [hjl@gnu-6 pr52146]$ cat a.s .file "a.i" .text .globl test5 .type test5, @function test5: .LFB0: .cfi_startproc movabsl 4276093056, %eax addl $5, %eax ret .cfi_endproc .LFE0: .size test5, .-test5 .ident "GCC: (GNU) 4.6.1 20110908 (Red Hat 4.6.1-9)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 pr52146]$ /export/build/gnu/gcc/build-x86_64-linux/gcc/xgcc -B/export/build/gnu/gcc/build-x86_64-linux/gcc/ -S -O a.i [hjl@gnu-6 pr52146]$ cat a.s .file "a.i" .text .globl test5 .type test5, @function test5: .LFB0: .cfi_startproc movabsl 4276093056, %eax movl %eax, -4(%rsp) addl $5, %eax ret .cfi_endproc .LFE0: .size test5, .-test5 .ident "GCC: (GNU) 4.7.0 20120209 (experimental)" .section .note.GNU-stack,"",@progbits [hjl@gnu-6 pr52146]$ GCC 4.7 generates extra store: movl %eax, -4(%rsp)