mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-07 14:27:59 +02:00
* floating point division by zero should throw run time error 208, fixed
git-svn-id: trunk@46210 -
This commit is contained in:
parent
b60ac4c2db
commit
7281ea7a2c
@ -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 }
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -35,7 +35,7 @@ begin
|
||||
FPE_INTOVF:
|
||||
res:=215;
|
||||
FPE_FLTDIV:
|
||||
res:=200;
|
||||
res:=208;
|
||||
FPE_FLTOVF:
|
||||
res:=205;
|
||||
FPE_FLTUND:
|
||||
|
@ -35,7 +35,7 @@ begin
|
||||
FPE_INTOVF:
|
||||
res:=215;
|
||||
FPE_FLTDIV:
|
||||
res:=200;
|
||||
res:=208;
|
||||
FPE_FLTOVF:
|
||||
res:=205;
|
||||
FPE_FLTUND:
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -52,7 +52,7 @@ begin
|
||||
FPE_INTOVF:
|
||||
res:=205;
|
||||
FPE_FLTDIV:
|
||||
res:=200;
|
||||
res:=208;
|
||||
FPE_FLTOVF:
|
||||
res:=205;
|
||||
FPE_FLTUND:
|
||||
|
@ -58,7 +58,7 @@ begin
|
||||
FPE_INTOVF:
|
||||
res:=205;
|
||||
FPE_FLTDIV:
|
||||
res:=200;
|
||||
res:=208;
|
||||
FPE_FLTOVF:
|
||||
res:=205;
|
||||
FPE_FLTUND:
|
||||
|
@ -52,7 +52,7 @@ begin
|
||||
FPE_INTOVF:
|
||||
res:=205;
|
||||
FPE_FLTDIV:
|
||||
res:=200;
|
||||
res:=208;
|
||||
FPE_FLTOVF:
|
||||
res:=205;
|
||||
FPE_FLTUND:
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user