help-gplusplus
[Top][All Lists]
Advanced

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

Re: _mm_add_ps SIGSEGV


From: Paul Pluzhnikov
Subject: Re: _mm_add_ps SIGSEGV
Date: Mon, 05 Jun 2006 13:02:51 -0700
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

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

> My first thought was that I had some how done something wrong with the
> alignment

That appears to be correct guess.

> - 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":

  If the operand of `__alignof__' is an lvalue rather than a type,
  its value is the required alignment for its type, taking into
  account any minimum alignment specified with GCC's `__attribute__'
  extension (*note Variable Attributes::).  For example, after
  this declaration:

     struct foo { int x; char y; } foo1;

  the value of `__alignof__ (foo1.y)' is 1, even though its actual
  alignment is probably 2 or 4, the same as `__alignof__ (int)'.

IOW, '__alignof__(this->data[0])' is 16 because that's what __m128
*should* be aligned on. But *actual* alignment of this->data[0] is 
8 (which isn't good enough):

> (gdb) print this->data
> $3 = (__m128 *) 0x8050978

Cheers,
-- 
In order to understand recursion you must first understand recursion.
Remove /-nsp/ for email.


reply via email to

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