help-gplusplus
[Top][All Lists]
Advanced

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

Re: _mm_add_ps SIGSEGV


From: Alan Woodland
Subject: Re: _mm_add_ps SIGSEGV
Date: Tue, 06 Jun 2006 13:06:07 +0100
User-agent: Debian Thunderbird 1.0.2 (X11/20060423)

Paul Pluzhnikov wrote:
> Alan Woodland <ajw05@aber.ac.uk> writes:

[snipped]

>>- I'm using template specialization to facilitate this, so I
>>added the following asserts just before the offending code:
>>
>>assert(__alignof__(__m128) == __alignof__(this->data[0]));
>>assert(__alignof__(__m128) == __alignof__(o.data[0]));
> 
> 
> These assert()s aren't good. From "info gcc":
> 

[snipped]

Thanks for the reply.

I've looked into why data[0] wouldn't be aligned right, and produced a
simple example below:

   __m128 a,b;

   __m128 *c = new __m128[10];

   std::cout << c << std::endl;
   std::cout << &a << ", " << &b << std::endl;

   _mm_add_ps(a,b);

   _mm_add_ps(c[0], c[1]);

This code segfaults on the last line quoted here, which isn't surprising
because c isn't aligned correctly. My question now is twofold:
a) Why isn't c aligned how __m128 needs to be? and
b) How to work around it? Is it even possible to get an array of __m128s
aligned correctly?

Thanks,
Alan


reply via email to

[Prev in Thread] Current Thread [Next in Thread]