http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52838
Bug #: 52838 Summary: [x32] missed optimization for pointer return value Classification: Unclassified Product: gcc Version: 4.7.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: target AssignedTo: unassig...@gcc.gnu.org ReportedBy: bartolde...@users.sourceforge.net The program test.c: extern void *foo(void); extern void bar(void*); void test(void) { bar(foo()); } when compiled with gcc-4.7 -mx32 -Os -S test.c produces: .file "test.c" .text .globl test .type test, @function test: .LFB0: .cfi_startproc pushq %rax .cfi_def_cfa_offset 16 call foo popq %rdx .cfi_def_cfa_offset 8 movq %rax, %rdi jmp bar .cfi_endproc .LFE0: .size test, .-test .ident "GCC: (Debian 4.7.0-1) 4.7.0" .section .note.GNU-stack,"",@progbits Here "movq %rax, %rdi" could be replaced by "movl %eax, %edi", saving one prefix byte 0x48.