[Speex-dev] SSE bug on Win32 with GCC 4.2.1

Thorvald Natvig speex at natvig.com
Mon Aug 20 17:30:26 PDT 2007


Jean-Marc Valin wrote:
>> I recently found a .. weird bug on Win32 SSE with GCC 4.2.1.
>>
>> In libspeex/cb_search_sse.h, the following union is used:
>>
>> union {
>>    float __a[4];
>>    __m128 __v;
>>  } __u;
>>
>> For some odd reason, this particular version of GCC will not 16-byte
>> align the union. IE; the alignment requirement of __v isn't propagated.
>> Changing it into this:
>>
>>  union {
>>    float __a[4];
>>    __m128 __v;
>>  } __u __attribute__((aligned(16)));
>>
>> And it works again. This is definitely a GCC bug, but I thought I'd
>> mention it here in case others have similar problems.
> 
> That's, euh... "interesting". Did you submit a bug report to the gcc
> team? I guess I could add your code as a workaround (do you know what
> version started supporting that attribute?) until it's fixed. I just
> find it amazing how many bugs in gcc Speex has managed to trigger. I
> believe this is at least the third one related to SSE (one in 3.4, one
> in 4.1).
> 
> 	Jean-Marc

It's supported on at least GCC 3.2, but it is very GCC specific and 
breaks horribly with any other compiler.

However, I think this might be "local" to the windows versions of gcc 
4.2. I'll install GCC on a few more platforms and try to verify it.


More information about the Speex-dev mailing list