need clarification of operator new and __m128
Matthias Kretz
Matthias.Kretz@kip.uni-heidelberg.de
Fri Aug 14 12:11:00 GMT 2009
Hi,
am I right in assuming that
struct A
{
__m128 d;
};
int main()
{
A *a = new A[1000];
assert((long)a & 0xf == 0);
return 0;
}
is safe?
Because I just debugged a program (compiled with gcc (Debian 4.3.2-1.1) 4.3.2
on 32 bit x86) where the program segfaults on
movaps %xmm0,(%edx,%eax,1)
where
(gdb) p/x $edx
$1 = 0xb68d4008
(gdb) p/x $eax
$2 = 0x0
(gdb) p a
$3 = 0xb68d4008
a is the array that was initialized with a(new Vector[SOME_NUMBER]) and Vector
is a class that contains only one __m128 member.
Is this a bug in my code or in gcc? Do I have to add the alignment restriction
to the Vector class itself also?
Regards,
Matthias
More information about the Gcc-help
mailing list