[Bug target/50725] [4.7 regression] -O3 -mstackrealign -march=core2 generates invalid prologue code in callee procedure
mikpe at it dot uu.se
gcc-bugzilla@gcc.gnu.org
Sat Nov 5 13:59:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50725
Mikael Pettersson <mikpe at it dot uu.se> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |mikpe at it dot uu.se
--- Comment #13 from Mikael Pettersson <mikpe at it dot uu.se> 2011-11-05 13:58:55 UTC ---
I see an obvious regression with gcc-4.7 compared to 4.6 on cygwin. With 4.6.1
built natively on cygwin the code starts with:
__pei386_runtime_relocator:
LFB2:
.cfi_startproc
leal 4(%esp), %ecx
.cfi_def_cfa 1, 0
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
movl %esp, %ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
pushl %edi
pushl %esi
pushl %ebx
pushl %ecx
.cfi_escape 0xf,0x3,0x75,0x70,0x6
.cfi_escape 0x10,0x3,0x2,0x75,0x74
.cfi_escape 0x10,0x6,0x2,0x75,0x78
.cfi_escape 0x10,0x7,0x2,0x75,0x7c
subl $56, %esp
movl (%ecx), %eax
cmpl $226, 8(%eax)
that is, the parameter is on the stack just above the return address.
With gcc-4.7-20111029 built as a cross to cygwin, the code starts with:
__pei386_runtime_relocator:
LFB2:
.cfi_startproc
movl (%ecx), %eax
cmpl $226, 8(%eax)
jg L15
ret
.p2align 4,,10
L15:
leal 4(%esp), %ecx
.cfi_def_cfa 1, 0
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
movl %esp, %ebp
which is just completely bonkers.
This code looks shrink-wrapped; passing -fno-shrink-wrap changes it to:
__pei386_runtime_relocator:
LFB2:
.cfi_startproc
leal 4(%esp), %ecx
.cfi_def_cfa 1, 0
andl $-16, %esp
pushl -4(%ecx)
pushl %ebp
.cfi_escape 0x10,0x5,0x2,0x75,0
movl %esp, %ebp
pushl %edi
pushl %esi
pushl %ebx
pushl %ecx
.cfi_escape 0xf,0x3,0x75,0x70,0x6
subl $56, %esp
.cfi_escape 0x10,0x7,0x2,0x75,0x7c
.cfi_escape 0x10,0x6,0x2,0x75,0x78
.cfi_escape 0x10,0x3,0x2,0x75,0x74
movl (%ecx), %eax
cmpl $226, 8(%eax)
which is similar to the code from gcc-4.6.1.
More information about the Gcc-bugs
mailing list