https://gcc.gnu.org/bugzilla/show_bug.cgi?id=102355
Andrew Pinski <pinskia at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |missed-optimization Severity|normal |enhancement --- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> --- I suspect is more related to how GCC handles frame pointers and stack pointers. As seen by -fno-omit-frame-pointer with both GCC and LLVM. The frame pointer needs to be 16 byte aligned and you can see LLVM generates the same code as GCC does when this is true: pushq %rbp movq %rsp, %rbp subq $16, %rsp leaq -8(%rbp), %rdi callq escape(unsigned long long&) addq $16, %rsp popq %rbp retq GCC omitting the frame pointer is not much difference than when it is not omitting it except it just does not use the frame pointer at all. subq $24, %rsp leaq 8(%rsp), %rdi call escape(unsigned long long&) addq $24, %rsp ret So GCC stack frame is GCC makes this stack layout: 8 bytes padding 8 bytes variable "local" 8 bytes padding (where the frame pointer would be stored) 8 bytes return address It just happens LLVM decides to reuse that location for local variables.