mingw32 misaligns SSE code (leading to crash of compiled programs)
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
mingw32 (Ubuntu) |
New
|
Undecided
|
Unassigned |
Bug Description
Binary package hint: mingw32
Package: mingw32 version 4.2.1.dfsg-1ubuntu1
Debian Release: lenny/sid
APT prefers hardy-updates
APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy')
Architecture: amd64 (x86_64)
Hi, when using this version of mingw32 to cross-compile FFTW for Win32,
we noticed that it miscompiles SSE code by generating misaligned data;
this causes the compiled code to crash when run. mingw32 in Debian
stable works fine. We've boiled it down to a simple test C file:
#include <xmmintrin.h>
union uvec {
unsigned int x[4];
__m128 v;
};
union uvec foo = { 1, 2, 3, 4};
Compile with:
i586-mingw32ms
and look at the resulting bug.s assembler output. It is:
.file "bug.c"
.globl _foo
.data
.align 8
_foo:
.long 1
.long 2
.long 3
.long 4
Note the ".align 8" -- SSE code like this __m128 variable must be
16-byte aligned, so it should be ".align 16".
In contrast, i586-mingw32msv
mingw correctly produces ".align 16". Similarly, Ubuntu's native gcc
4.2.4 correctly produces ".align 16". Hopefully, there is a newer
upstream version of mingw32 that fixes this.