I'm using the eval 7.0 C++ for IA-32, integrated with MSVC6 SP5. I have found that the operator new doesn't always return a properly aligned object.
The following program *sometimes* exhibits the issue:
using namespace std;
cout << "F32vec4 is " << sizeof(F32vec4) << " bytes." << endl;
F32vec4 *foo = new F32vec4;
cout << "pointer foo is 0x" << foo << endl;
F32vec4 *bar = new F32vec4;
cout << "pointer bar is 0x" << bar << endl;
*foo += *bar;
operator new should align an F32vec4 to 16 bytes. But often only 8-byte alignment is done. This causes the program to crash when the 16-byte movaps for the arithmetic operation += is encountered.
The program may work, by chance, if the two allocations turn out to be aligned. I get different alignment results when I run with the debugger, without the debugger, compile for debug single-threaded, compile for debug multi-threaded DLL, etc. It really should work in all these cases. I have seen similar results under the .NET environment.
I guess there is some question over whether new alignment is part of the Intel compiler or the Microsoft runtime. Even if it is determined to be a problem in the runtime, it would be good to get a workaround. Otherwise it is difficult to use SSE and SSE2 intrinsics/libraries in dynamically allocated classes.