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.
<br><br><br><div><span class="gmail_quote">On 8/20/07, <b class="gmail_sendername">Thorvald Natvig</b> <<a href="mailto:speex@natvig.com">speex@natvig.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Jean-Marc Valin wrote:<br>>> I recently found a .. weird bug on Win32 SSE with GCC 4.2.1.<br>>><br>>> In libspeex/cb_search_sse.h, the following union is used:<br>>><br>>> union {<br>>> float __a[4];
<br>>> __m128 __v;<br>>> } __u;<br>>><br>>> For some odd reason, this particular version of GCC will not 16-byte<br>>> align the union. IE; the alignment requirement of __v isn't propagated.
<br>>> Changing it into this:<br>>><br>>> union {<br>>> float __a[4];<br>>> __m128 __v;<br>>> } __u __attribute__((aligned(16)));<br>>><br>>> And it works again. This is definitely a GCC bug, but I thought I'd
<br>>> mention it here in case others have similar problems.<br>><br>> That's, euh... "interesting". Did you submit a bug report to the gcc<br>> team? I guess I could add your code as a workaround (do you know what
<br>> version started supporting that attribute?) until it's fixed. I just<br>> find it amazing how many bugs in gcc Speex has managed to trigger. I<br>> believe this is at least the third one related to SSE (one in
3.4, one<br>> in 4.1).<br>><br>> Jean-Marc<br><br>It's supported on at least GCC 3.2, but it is very GCC specific and<br>breaks horribly with any other compiler.<br><br>However, I think this might be "local" to the windows versions of gcc
<br>4.2. I'll install GCC on a few more platforms and try to verify it.<br>_______________________________________________<br>Speex-dev mailing list<br><a href="mailto:Speex-dev@xiph.org">Speex-dev@xiph.org</a><br><a href="http://lists.xiph.org/mailman/listinfo/speex-dev">
http://lists.xiph.org/mailman/listinfo/speex-dev</a><br></blockquote></div><br>