$ cat > test.c extern int g(int); int f(int x) { return g(x); } $ gcc -S -O3 test.c -o - .file "test.c" .text .p2align 4,,15 .globl f .type f, @function f: pushl %ebp movl %esp, %ebp popl %ebp jmp g .size f, .-f .section .note.GNU-stack,"",@progbits .ident "GCC: (GNU) 3.4.3 20050104 (ALT Linux, build 3.4.3-alt2)" Obviously, pushl/movl/popl code does nothing and can be completely ommited.
look at 4.1?
Same with gcc-4.1.1; maybe I should report it upstream? :)
It seems fixed in gcc4.5: $ gcc -S -O3 test.c -o - .file "test.c" .text .p2align 4,,15 .globl f .type f, @function f: .LFB0: .cfi_startproc jmp g .cfi_endproc .LFE0: .size f, .-f .ident "GCC: (GNU) 4.5.1 20100924 (ALT Linux 4.5.1-alt1)" .section .note.GNU-stack,"",@progbits