Browse Source

* floating point division by zero should throw run time error 208, fixed

git-svn-id: trunk@46210 -
florian 5 years ago
parent
commit
7281ea7a2c

+ 1 - 1
rtl/aix/sighnd.inc

@@ -25,7 +25,7 @@ begin
     SIGFPE :
       begin
         Case Info^.si_code Of
-          FPE_FLTDIV,
+          FPE_FLTDIV : Res:=208;  { floating point divide by zero }
           FPE_INTDIV : Res:=200;  { floating point divide by zero }
           FPE_FLTOVF : Res:=205;  { floating point overflow }
           FPE_FLTUND : Res:=206;  { floating point underflow }

+ 1 - 1
rtl/beos/i386/sighnd.inc

@@ -35,7 +35,7 @@ begin
           begin
             { first check the more precise options }
             if (FpuState and FPU_DivisionByZero)<>0 then
-              res:=200
+              res:=208
             else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
               res:=207
             else if (FpuState and FPU_Overflow)<>0 then

+ 1 - 1
rtl/go32v2/dpmiexcp.pp

@@ -1600,7 +1600,7 @@ begin
          else if (FpuStatus and FPU_Denormal)<>0 then
            ErrorOfSig:=216
          else if (FpuStatus and FPU_DivisionByZero)<>0 then
-           ErrorOfSig:=200
+           ErrorOfSig:=208
          else if (FpuStatus and FPU_Overflow)<>0 then
            ErrorOfSig:=205
          else if (FpuStatus and FPU_Underflow)<>0 then

+ 1 - 1
rtl/haiku/i386/sighnd.inc

@@ -35,7 +35,7 @@ begin
           begin
             { first check the more precise options }
             if (FpuState and FPU_DivisionByZero)<>0 then
-              res:=200
+              res:=208
             else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
               res:=207
             else if (FpuState and FPU_Overflow)<>0 then

+ 1 - 1
rtl/haiku/x86_64/sighnd.inc

@@ -35,7 +35,7 @@ begin
           begin
             { first check the more precise options }
             if (FpuState and FPU_DivisionByZero)<>0 then
-              res:=200
+              res:=208
             else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
               res:=207
             else if (FpuState and FPU_Overflow)<>0 then

+ 1 - 1
rtl/i8086/math.inc

@@ -64,7 +64,7 @@
             else if (FpuStatus and FPU_Denormal)<>0 then
               OutError:=216
             else if (FpuStatus and FPU_DivisionByZero)<>0 then
-              OutError:=200
+              OutError:=208
             else if (FpuStatus and FPU_Overflow)<>0 then
               OutError:=205
             else if (FpuStatus and FPU_Underflow)<>0 then

+ 1 - 1
rtl/inc/genmath.inc

@@ -122,7 +122,7 @@ Begin
   if (float_flag_invalid in unmasked_flags) then
      HandleError(207)
   else if (float_flag_divbyzero in unmasked_flags) then
-     HandleError(200)
+     HandleError(208)
   else if (float_flag_overflow in unmasked_flags) then
      HandleError(205)
   else if (float_flag_underflow in unmasked_flags) then

+ 1 - 1
rtl/linux/m68k/sighnd.inc

@@ -106,7 +106,7 @@ begin
             begin
               { first check the more precise options }
               if (FpuState and (DivideByZero or AE_DividebyZero))<>0 then
-                res:=200
+                res:=208
               else if (FpuState and (Overflow or AE_Overflow))<>0 then
                 res:=205
               else if (FpuState and (Underflow or AE_Underflow))<>0 then

+ 1 - 1
rtl/linux/powerpc/sighnd.inc

@@ -28,7 +28,7 @@ begin
   case sig of
     SIGFPE :
       case (SigInfo^.si_code) of
-        FPE_FLTDIV : res := 200;
+        FPE_FLTDIV : res := 208;
         FPE_FLTOVF : res := 205;
         FPE_FLTUND : res := 206;
         else

+ 1 - 1
rtl/linux/powerpc64/sighnd.inc

@@ -27,7 +27,7 @@ begin
     SIGFPE :
       { distuingish between different FPU exceptions }
       case (SigInfo^.si_code) of
-        FPE_FLTDIV : res := 200;
+        FPE_FLTDIV : res := 208;
         FPE_FLTOVF : res := 205;
         FPE_FLTUND : res := 206;
         else

+ 1 - 1
rtl/linux/sparc/sighnd.inc

@@ -35,7 +35,7 @@ begin
                 FPE_INTOVF:
                   res:=215;
                 FPE_FLTDIV:
-                  res:=200;
+                  res:=208;
                 FPE_FLTOVF:
                   res:=205;
                 FPE_FLTUND:

+ 1 - 1
rtl/linux/sparc64/sighnd.inc

@@ -35,7 +35,7 @@ begin
                 FPE_INTOVF:
                   res:=215;
                 FPE_FLTDIV:
-                  res:=200;
+                  res:=208;
                 FPE_FLTOVF:
                   res:=205;
                 FPE_FLTUND:

+ 1 - 1
rtl/linux/x86_64/sighnd.inc

@@ -70,7 +70,7 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
                 begin
                   { first check the more precise options }
                   if (FpuState and FPU_DivisionByZero)<>0 then
-                    res:=200
+                    res:=208
                   else if (FpuState and FPU_Overflow)<>0 then
                     res:=205
                   else if (FpuState and FPU_Underflow)<>0 then

+ 1 - 1
rtl/netbsd/arm/sighnd.inc

@@ -33,7 +33,7 @@ begin
     res:=0;
     if signo = SIGFPE then
      begin
-        res := 200;
+        res := 208;
      end
     else
     if (signo = SIGILL) or (signo = SIGBUS) or (signo = SIGSEGV) then

+ 1 - 1
rtl/netbsd/m68k/sighnd.inc

@@ -26,7 +26,7 @@ begin
     res:=0;
     if signo = SIGFPE then
      begin
-        res := 200;
+        res := 208;
      end
     else
     if (signo = SIGILL) or (signo = SIGBUS) or (signo = SIGSEGV) then

+ 1 - 1
rtl/netbsd/powerpc/sighnd.inc

@@ -27,7 +27,7 @@ begin
     res:=0;
     if signo = SIGFPE then
      begin
-        res := 200;
+        res := 208;
      end
     else
     if (signo = SIGILL) or (signo = SIGBUS) or (signo = SIGSEGV) then

+ 1 - 1
rtl/netbsd/x86_64/sighnd.inc

@@ -73,7 +73,7 @@ begin
             begin
               { first check the more precise options }
               if (FpuState and FPU_DivisionByZero)<>0 then
-                res:=200
+                res:=208
               else if (FpuState and FPU_Overflow)<>0 then
                 res:=205
               else if (FpuState and FPU_Underflow)<>0 then

+ 1 - 1
rtl/openbsd/i386/sighnd.inc

@@ -68,7 +68,7 @@ begin
             begin
               { first check the more precise options }
               if (FpuState and FPU_DivisionByZero)<>0 then
-                res:=200
+                res:=208
               else if (FpuState and FPU_Overflow)<>0 then
                 res:=205
               else if (FpuState and FPU_Underflow)<>0 then

+ 1 - 1
rtl/openbsd/x86_64/sighnd.inc

@@ -62,7 +62,7 @@ begin
             begin
               { first check the more precise options }
               if (FpuState and FPU_DivisionByZero)<>0 then
-                res:=200
+                res:=208
               else if (FpuState and FPU_Overflow)<>0 then
                 res:=205
               else if (FpuState and FPU_Underflow)<>0 then

+ 1 - 1
rtl/os2/system.pas

@@ -492,7 +492,7 @@ begin
    case Report^.Exception_Num of
     Xcpt_Integer_Divide_By_Zero,
     Xcpt_Float_Divide_By_Zero:
-      Err := 200;
+      Err := 208;
     Xcpt_Array_Bounds_Exceeded:
      begin
       Err := 201;

+ 1 - 1
rtl/solaris/i386/sighnd.inc

@@ -52,7 +52,7 @@ begin
             FPE_INTOVF:
               res:=205;
             FPE_FLTDIV:
-              res:=200;
+              res:=208;
             FPE_FLTOVF:
               res:=205;
             FPE_FLTUND:

+ 1 - 1
rtl/solaris/sparc/sighnd.inc

@@ -58,7 +58,7 @@ begin
             FPE_INTOVF:
               res:=205;
             FPE_FLTDIV:
-              res:=200;
+              res:=208;
             FPE_FLTOVF:
               res:=205;
             FPE_FLTUND:

+ 1 - 1
rtl/solaris/x86_64/sighnd.inc

@@ -52,7 +52,7 @@ begin
             FPE_INTOVF:
               res:=205;
             FPE_FLTDIV:
-              res:=200;
+              res:=208;
             FPE_FLTOVF:
               res:=205;
             FPE_FLTUND:

+ 3 - 2
rtl/win32/system.pp

@@ -376,9 +376,10 @@ function syswin32_i386_exception_handler(excep : PExceptionPointers) : Longint;s
               hexstr(excep^.ExceptionRecord^.ExceptionCode, 8));
 {$endif SYSTEMEXCEPTIONDEBUG}
       case excep^.ExceptionRecord^.ExceptionCode of
-        STATUS_INTEGER_DIVIDE_BY_ZERO,
-        STATUS_FLOAT_DIVIDE_BY_ZERO :
+        STATUS_INTEGER_DIVIDE_BY_ZERO :
           err := 200;
+        STATUS_FLOAT_DIVIDE_BY_ZERO :
+          err := 208;
         STATUS_ARRAY_BOUNDS_EXCEEDED :
           begin
             err := 201;

+ 1 - 1
rtl/win64/system.pp

@@ -387,7 +387,7 @@ function syswin64_x86_64_exception_handler(excep : PExceptionPointers) : Longint
         case cardinal(excep^.ExceptionRecord^.ExceptionCode) of
           STATUS_INTEGER_DIVIDE_BY_ZERO,
           STATUS_FLOAT_DIVIDE_BY_ZERO :
-            err := 200;
+            err := 208;
           STATUS_ARRAY_BOUNDS_EXCEEDED :
             begin
               err := 201;

+ 1 - 1
rtl/wince/system.pp

@@ -1172,7 +1172,7 @@ begin
     case cardinal(ExceptionRecord^.ExceptionCode) of
       STATUS_INTEGER_DIVIDE_BY_ZERO,
       STATUS_FLOAT_DIVIDE_BY_ZERO :
-        res := 200;
+        res := 208;
       STATUS_ARRAY_BOUNDS_EXCEEDED :
         begin
           res := 201;

+ 1 - 1
tests/webtbs/tw37468.pp

@@ -13,7 +13,7 @@ begin
     try
       writeln(power(a,b));
     except
-      on e: EDivByZero do begin
+      on e: EZeroDivide do begin
         writeln(Infinity);
       end;
     end;