I'm getting a SegFault when I try to use a math function, but only when this function is inline and only when I compile in release mode. If I put it inside a CPP all works fine.
I get the error using versions 4.8.1 and 4.9.2.
These are the release compiling flags:
-O2 -march=pentium4 -mtune=pentium4 -msse -msse2 -mfpmath=sse -Wextra -Wall -pipe -fno-strict-aliasing -std=gnu++11
These are the debug compiling flags:
-g -O0 -march=pentium4 -mtune=pentium4 -msse -msse2 -mfpmath=sse -Wextra -Wall -pipe -fno-strict-aliasing -std=gnu++11
This is the function:
MATH_INLINE
CMatrix4_GL
CMatrix4_GL::Perspective(float fovy, float aspect, float zNear, float zFar)
{
ymax = zNear * MindShake::Tan(fovy * Float32::PI / 360.0f);
ymin = -ymax;
xmin = ymin * aspect;
xmax = ymax * aspect;return Frustum(xmin, xmax, ymin, ymax, zNear, zFar);
}
zFar = 3000.0f
MindShake::Tan is an inline tenplate function (float / double)
GDB / CodeBlocks get the SigFault when I try to execute this line:
ymin = -ymax;
All works fine using Visual Studio 2010, 2012 and 2013.
I think the problem is because the various inline functions.
Thanks in advance!
Anonymous
You should allways use a .cpp extension with C++ code anything else is just asking for trouble.
hint
CMatrix4_GL::Perspective is not C so i would be very surprised if gcc would not croak :)