This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/22229] New: Segfault due to unaligned movaps access
- From: "uros at kss-loka dot si" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 29 Jun 2005 12:38:42 -0000
- Subject: [Bug target/22229] New: Segfault due to unaligned movaps access
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This testcase segfaults due to unaligned movaps access when compiled with 'gcc -
O2 -msse':
--cut here--
#include <xmmintrin.h>
__m128 bar (__m128 x1, __m128 y1, __m128 x2, __m128 y2)
{
return x1;
}
__m128 foo (__m128 x)
{
return bar (x, x, x, x);
}
int main()
{
__m128 a = {1.0, 2.0, 3.0, 4.0};
union {
__m128 _xmm;
float x[4];
} temp;
temp._xmm = foo (a);
printf("%f\n", temp.x[2]);
return 0;
}
--cut here--
The problem is, that 4th parameter to bar is now passed on stack (this is
specified by x86 ABI). Unfortunatelly, stack is not aligned correctly and
testcase segfaults in foo():
foo:
subss %xmm1, %xmm0
pushl %ebp
movl %esp, %ebp
subl $16, %esp
movaps %xmm0, (%esp) <<<< here
movaps %xmm0, %xmm2
movaps %xmm0, %xmm1
call bar
leave
ret
Value of %esp is 0xbffff958 at the point of segfault.
--
Summary: Segfault due to unaligned movaps access
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: ssemmx
Severity: normal
Priority: P2
Component: target
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: uros at kss-loka dot si
CC: gcc-bugs at gcc dot gnu dot org
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22229