From c62810ee208e8a75e5fa8a0ccf9e830eea3d524f Mon Sep 17 00:00:00 2001 From: Don Clugston Date: Thu, 17 Feb 2011 09:56:39 +0100 Subject: [PATCH] Better error message for integer overflow exception I had read somewhere that this never happens on x86, but I discovered that isn't true -- it happens for division of (-int.max-1) % -1. Possibly for some other cases as well. --- src/rt/deh.d | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/rt/deh.d b/src/rt/deh.d index fa67d83199..e3d918ab94 100644 --- a/src/rt/deh.d +++ b/src/rt/deh.d @@ -623,6 +623,10 @@ Throwable _d_translate_se_to_d_exception(EXCEPTION_RECORD *exceptionRecord) pti = new Error("Integer Divide by Zero"); break; + case STATUS_INTEGER_OVERFLOW: // eg, int.min % -1 + pti = new Error("Integer Overflow"); + break; + case STATUS_FLOAT_DIVIDE_BY_ZERO: pti = new Error("Float Divide by Zero"); break; @@ -687,7 +691,6 @@ Throwable _d_translate_se_to_d_exception(EXCEPTION_RECORD *exceptionRecord) pti = new Error("Win32 In Page Exception"); break; /* - case STATUS_INTEGER_OVERFLOW: // not supported on any x86 processor case STATUS_INVALID_DISPOSITION: case STATUS_NONCONTINUABLE_EXCEPTION: case STATUS_SINGLE_STEP: