digitalmars.D.learn - Invalid Floating Point Operation (DMD 2067)
- ref2401 (93/93) Apr 16 2015 Hi Everyone,
- Steven Schveighoffer (3/12) Apr 16 2015 Builds and runs fine for me. What is your OS and build command?
- ref2401 (3/5) Apr 16 2015 Win 8.1
- rumbu (6/12) Apr 16 2015 Reduced case:
- rumbu (16/16) Apr 16 2015 On Thursday, 16 April 2015 at 20:27:46 UTC, rumbu wrote:
- Steven Schveighoffer (4/20) Apr 16 2015 Thanks, please file a bug, make it Windows specific, as I did not get
- rumbu (1/4) Apr 16 2015 Done: https://issues.dlang.org/show_bug.cgi?id=14452
Hi Everyone, After I switched to DMD 2067 my code that previously worked began crashing. If I change the return statement in the matrixOrtho function from: return Matrix(...); to: Matrix m = Matrix(...); return m; then the error won't occur anymore. What is going on? Thank you. import std.math; import std.stdio; struct Matrix { float m00, m01, m02, m03; float m10, m11, m12, m13; float m20, m21, m22, m23; float m30, m31, m32, m33; this(float m00, float m01, float m02, float m03, float m10, float m11, float m12, float m13, float m20, float m21, float m22, float m23, float m30, float m31, float m32, float m33) nothrow pure nogc { this.m00 = m00; this.m01 = m01; this.m02 = m02; this.m03 = m03; this.m10 = m10; this.m11 = m11; this.m12 = m12; this.m13 = m13; this.m20 = m20; this.m21 = m21; this.m22 = m22; this.m23 = m23; this.m30 = m30; this.m31 = m31; this.m32 = m32; this.m33 = m33; } } void main(string[] args) { float width = 800f; float height = 600f; float near = -5f; float far = 10f; float hw = width / 2f; float hh = height / 2f; Matrix ortho = matrixOrtho(-hw, hw, -hh, hh, near, far); } Matrix matrixOrtho(float left, float right, float bottom, float top, float near, float far) /* pure nogc */ { debug { FloatingPointControl fpCtrl; fpCtrl.enableExceptions(FloatingPointControl.severeExceptions); } float doubledNear = near*2f; float farMinusNear = far - near; float rightMinusLeft = right - left; float topMinusBottom = top - bottom; return Matrix(2f / rightMinusLeft, 0f, 0f, -(right + left)/rightMinusLeft, 0f, 2f / topMinusBottom, 0f, -(top + bottom)/topMinusBottom, 0f, 0f, -2f / farMinusNear, -(far + near)/farMinusNear, 0f, 0f, 0f, 1f); //Matrix m = Matrix(2f / rightMinusLeft, 0f, 0f, -(right + left)/rightMinusLeft, // 0f, 2f / topMinusBottom, 0f, -(top + bottom)/topMinusBottom, // 0f, 0f, -2f / farMinusNear, -(far + near)/farMinusNear, // 0f, 0f, 0f, 1f); //return m; } Error report: object.Error (0): Invalid Floating Point Operation ---------------- 0x00402340 0x004020E2 0x004029E2 0x004029B7 0x004028CF 0x004022D7 0x758D7C04 in BaseThreadInitThunk 0x77ADB54F in RtlInitializeExceptionChain 0x77ADB51A in RtlInitializeExceptionChain object.Error (0): Invalid Floating Point Operation ---------------- 0x00402340 0x004020E2 0x004029E2 0x004029B7 0x004028CF 0x004022D7 0x758D7C04 in BaseThreadInitThunk 0x77ADB54F in RtlInitializeExceptionChain 0x77ADB51A in RtlInitializeExceptionChain object.Error (0): Invalid Floating Point Operation ---------------- 0x00406E5B 0x004029C5 0x004028CF 0x004022D7 0x758D7C04 in BaseThreadInitThunk 0x77ADB54F in RtlInitializeExceptionChain 0x77ADB51A in RtlInitializeExceptionChain
Apr 16 2015
On 4/16/15 10:23 AM, ref2401 wrote:Hi Everyone, After I switched to DMD 2067 my code that previously worked began crashing. If I change the return statement in the matrixOrtho function from: return Matrix(...); to: Matrix m = Matrix(...); return m; then the error won't occur anymore. What is going on?Builds and runs fine for me. What is your OS and build command? -Steve
Apr 16 2015
Builds and runs fine for me. What is your OS and build command? -SteveWin 8.1 dmd main.d -ofmain.exe -debug -unittest -wi if %errorLevel% equ 0 (main.exe)
Apr 16 2015
On Thursday, 16 April 2015 at 15:00:39 UTC, ref2401 wrote:Reduced case: struct S { float f; }Builds and runs fine for me. What is your OS and build command? -SteveWin 8.1 dmd main.d -ofmain.exe -debug -unittest -wi if %errorLevel% equ 0 (main.exe)
Apr 16 2015
On Thursday, 16 April 2015 at 20:27:46 UTC, rumbu wrote: Hit send by accident :) Reduced case: struct S { float f; //or double or real this(float f) { this.f = f; } } S foo() { return S(0f); } void main() { auto s = foo(); } Win 8.1 also, 32 and 64 bit, debug or release, same exception
Apr 16 2015
On 4/16/15 4:32 PM, rumbu wrote:On Thursday, 16 April 2015 at 20:27:46 UTC, rumbu wrote: Hit send by accident :) Reduced case: struct S { float f; //or double or real this(float f) { this.f = f; } } S foo() { return S(0f); } void main() { auto s = foo(); } Win 8.1 also, 32 and 64 bit, debug or release, same exceptionThanks, please file a bug, make it Windows specific, as I did not get the exception on OSX. -Steve
Apr 16 2015
Thanks, please file a bug, make it Windows specific, as I did not get the exception on OSX. -SteveDone: https://issues.dlang.org/show_bug.cgi?id=14452
Apr 16 2015