[Speex-dev] SSE bug on Win32 with GCC 4.2.1
Jean-Marc Valin
jean-marc.valin at usherbrooke.ca
Wed Aug 22 17:23:32 PDT 2007
Duane Storey a écrit :
> Actually, it might just be an OS "feature".. On most linux and mac
> platforms, the memory managers align memory on proper boundaries -- this
> doesn't occur on most versions of windows. I don't have all the code in
> front of me, but it's possible that it's simply a side effect of windows not
> aligning the memory, and an implicit assumption in the speex code that it
> will have proper alignment.
I actually doubt it's the OS (as much as I hate Windows). After all,
it's the compiler that manages the stack and needs to ensure alignment.
Jean-Marc
>
> On 8/20/07, Thorvald Natvig <speex at natvig.com> wrote:
>> 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.
>> _______________________________________________
>> Speex-dev mailing list
>> Speex-dev at xiph.org
>> http://lists.xiph.org/mailman/listinfo/speex-dev
>>
>
More information about the Speex-dev
mailing list