https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85939
Bug ID: 85939
Summary: -mstackrealign does not realign stack with local __m64
variable
Product: gcc
Version: 8.1.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: target
Assignee: unassigned at gcc dot gnu.org
Reporter: fw at gcc dot gnu.org
Target Milestone: ---
Target: i386-*-linux-gnu
Consider this test case:
#include <xmmintrin.h>
int f1 (__m64 *);
int
f2 (void)
{
__m64 v;
return f1 (&v);
}
My understanding is that the i386 ABI requires 8-byte alignment for __m64
objects. However, with “gcc -m32 -mstackrealign -O2”, I get this:
.p2align 4,,15
.globl f2
.type f2, @function
f2:
.LFB504:
.cfi_startproc
subl $40, %esp
.cfi_def_cfa_offset 44
leal 20(%esp), %eax
pushl %eax
.cfi_def_cfa_offset 48
call f1
addl $44, %esp
.cfi_def_cfa_offset 4
ret
.cfi_endproc
.LFE504:
.size f2, .-f2
This will not produce a correctly aligned object if the stack alignment is off
by 4 (or 12) bytes.