gcc 4.4 is generating stack frame offsets to compiler-generated locals that are not 16-byte aligned for sse2 instructions, causing #GP(0) faults.
This bug is different than artifact id# 1008330 (movaps problem with mingw). That bug was due to the fact that the base pointer itself was not aligned at function entry, rather than frame offsets being unaligned.
In the attached submission file, compiled with:
g++ -O3 -msse3 -g3 -Wall -c -save-temps -osubmission.o submission.cpp
the following assembly code is emitted:
# 60 "..\submission.cpp" 1
# 0 "" 2
.loc 1 103 0
addpd %xmm0, %xmm0
movapd %xmm0, -88(%ebp)
The frame offset of the destination operand in the movapd instruction, -88, is not 16-byte aligned and causes a GP fault.
The same file compiled with:
g++ -O0 -msse3 -g3 -Wall -c -save-temps -osubmission.o submission.cpp
generates a different sequence for the same source (obviously) that does not exhibit the same error as above. However, later in the same output the following sequence is emitted:
.loc 1 127 0
movsd -40(%ebp), %xmm0
movhpd -32(%ebp), %xmm0
cmpltpd -216(%ebp), %xmm0
movlpd %xmm0, -40(%ebp)
movhpd %xmm0, -32(%ebp)
The frame offset value of the source operand in the cmpltpd instruction, -216, is not 16-byte aligned, and generates a GP fault.