need clarification of operator new and __m128

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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

[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux