I'm getting warning C4744 from the linker when building with LTCG. The
following sample reproduces it:
---------------------------
// Header.h
#include <xmmintrin.h>
class Vector;
extern const Vector ZeroVector;
class Vector
{
public:
Vector( float x_, float y_, float z_, float w_ ) : x(x_), y(y_), z(z_),
w(w_) {}
union
{
struct { float x, y, z, w; };
__m128 q;
};
};
---------------------------
// Source1.cpp
#include "Header.h"
const Vector ZeroVector( 0.0f, 0.0f, 0.0f, 0.0f );
---------------------------
// Source2.cpp
#include "Header.h"
#include <stdio.h>
void main()
{
printf( "%f\n", ZeroVector.x );
}
---------------------------
Is the warning erroneous? The compiler only emits it in LTCG builds - but
could it cause bad code generation in other configs? What's the correct
workaround here, the warning seems to go away only if I tag the declaration
of ZeroVector with __declspec( align(16) ). Should it be necessary in this
case though?
--
Andy