Bug 41950 - Unaligned writes (?) to __m128
Summary: Unaligned writes (?) to __m128
Status: RESOLVED DUPLICATE of bug 37216
Alias: None
Product: gcc
Classification: Unclassified
Component: target (show other bugs)
Version: 4.4.0
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-11-05 14:53 UTC by Sebastian Mach
Modified: 2009-11-06 09:32 UTC (History)
12 users (show)

See Also:
Host:
Target: mingw32
Build:
Known to work:
Known to fail:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Sebastian Mach 2009-11-05 14:53:28 UTC
C:\MinGW\bin>g++.exe -v
Es werden eingebaute Spezifikationen verwendet.
Ziel: mingw32
Konfiguriert mit: ../gcc-4.4.0/configure --enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --disable-sjlj-exception
s --enable-shared --enable-libgcj --enable-libgomp --with-dwarf2 --disable-win32-registry --enable-libstdcxx-debug --ena
ble-version-specific-runtime-libs --prefix=/mingw --with-gmp=/mingw/src/gmp/root --with-mpfr=/mingw/src/mpfr/root --buil
d=mingw32
Thread-Modell: win32
gcc-Version 4.4.0 (GCC)



The following snippets crash the running application, I guess due to unaligned writes, but __alignof__ gives me 16 for all three versions, so I really don't know.

// 0) anonymous namespace: not happy
#include <xmmintrin.h>
namespace { __m128 a; }
int main () {a = _mm_set1_ps(.0f); }

// 1) external: happy
#include <xmmintrin.h>
__m128 a;
int main () { a = _mm_set1_ps(.0f); }

// 2) internal: not happy
#include <xmmintrin.h>
static __m128 a;
int main () { a = _mm_set1_ps(.0f); }
Comment 1 Richard Biener 2009-11-05 15:30:11 UTC
I guess win32 doesn't know about aligned commons?  Try updating to 4.4.2.
Comment 2 Ozkan Sezer 2009-11-05 15:55:39 UTC
PR target/37216 probably?  If that is so, gcc-4.4.2 won't help because the fix hasn't been backported to 4.4, at least not yet.
Comment 3 Uroš Bizjak 2009-11-05 17:38:46 UTC
(In reply to comment #1)
> I guess win32 doesn't know about aligned commons?  Try updating to 4.4.2.

You can also use -fno-common as a workaround.
Comment 4 Andrew Pinski 2009-11-05 17:42:54 UTC

*** This bug has been marked as a duplicate of 37216 ***
Comment 5 Sebastian Mach 2009-11-06 09:24:39 UTC
(In reply to comment #3)
> (In reply to comment #1)
> > I guess win32 doesn't know about aligned commons?  Try updating to 4.4.2.
> 
> You can also use -fno-common as a workaround.
> 

Unfortunately, this does not work for at least testcase 0), __attribute__((nocommon)) does not to work either.

I will try out 4.5. asap (I am in relocation mode, i.e. only have access to my work-pc at the moment, so updating is a bit clumsy here).
Comment 6 Sebastian Mach 2009-11-06 09:32:12 UTC
(In reply to comment #5)
> (In reply to comment #3)
> > (In reply to comment #1)
> > > I guess win32 doesn't know about aligned commons?  Try updating to 4.4.2.
> > 
> > You can also use -fno-common as a workaround.
> > 
> 
> Unfortunately, this does not work for at least testcase 0),
> __attribute__((nocommon)) does not to work either.
> 
> I will try out 4.5. asap (I am in relocation mode, i.e. only have access to my
> work-pc at the moment, so updating is a bit clumsy here).
> 

Self-reply: If all else fails, use _mm_alloc(size,align).