https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64242
Jakub Jelinek <jakub at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jakub at gcc dot gnu.org
--- Comment #10 from Jakub Jelinek <jakub at gcc dot gnu.org> ---
The testcase also FAILs on x86_64-linux and i686-linux for me.
The testcase is just invalid, you can't assume that __builtin_alloca (0) will
not allocate anything on the stack at all, on many targets it does.
E.g. on x86_64 it does:
movslq x(%rip), %rax
addq $23, %rax
andq $-16, %rax
subq %rax, %rsp
leaq 15(%rsp), %rax
andq $-16, %rax
movq %rax, p(%rip)
so for 0 it subtracts 16 bytes from %rsp.
What was the failure on i386?
I see
.cfi_startproc
pushl %ebp
.cfi_def_cfa_offset 8
.cfi_offset 5, -8
movl %esp, %ebp
.cfi_def_cfa_register 5
subl $32, %esp
movl 8(%ebp), %eax
movl (%eax), %edx
movl 8(%eax), %ecx
movl %edx, -20(%ebp)
movl 4(%eax), %edx
movl %ecx, -12(%ebp)
movl 12(%eax), %ecx
movl 16(%eax), %eax
movl %edx, -16(%ebp)
movl %ecx, -8(%ebp)
movl %eax, -4(%ebp)
movl -20(%ebp), %ebp
movl -12(%ebp), %esp
jmp *%edx
.cfi_endproc
At the start of the movl -20(%ebp), %ebp instruction both -12(%ebp) and
-12(-20(%ebp)) contain the same value though, it has been stored there a few
instructions earlier (movl %ecx, -12(%ebp) above it).