* denormalized value floating point exception has to result in an rte 206, resolves part of #37926

git-svn-id: trunk@47114 -
This commit is contained in:
florian 2020-10-15 19:52:57 +00:00
parent 3b0168ae16
commit 15695b317c
4 changed files with 29 additions and 5 deletions

1
.gitattributes vendored
View File

@ -18491,6 +18491,7 @@ tests/webtbs/tw37806.pp svneol=native#text/pascal
tests/webtbs/tw3782.pp svneol=native#text/plain
tests/webtbs/tw37823.pp svneol=native#text/pascal
tests/webtbs/tw37844.pp svneol=native#text/pascal
tests/webtbs/tw37926.pp svneol=native#text/pascal
tests/webtbs/tw3796.pp svneol=native#text/plain
tests/webtbs/tw3805.pp svneol=native#text/plain
tests/webtbs/tw3814.pp svneol=native#text/plain

View File

@ -60,7 +60,7 @@ begin
else if (FpuState and FPU_Underflow)<>0 then
res:=206
else if (FpuState and FPU_Denormal)<>0 then
res:=216
res:=206
else
res:=207; {'Coprocessor Error'}
end;
@ -80,7 +80,7 @@ begin
else if (MMState and MM_Underflow)<>0 then
res:=206
else if (MMState and MM_Denormal)<>0 then
res:=216
res:=206
else
res:=207; {'Coprocessor Error'}
end;

View File

@ -76,7 +76,7 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
else if (FpuState and FPU_Underflow)<>0 then
res:=206
else if (FpuState and FPU_Denormal)<>0 then
res:=216
res:=206
else if (FpuState and (FPU_StackOverflow or FPU_StackUnderflow or FPU_Invalid))<>0 Then
res:=207
else
@ -100,7 +100,7 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
else if (MMState and MM_Underflow)<>0 then
res:=206
else if (MMState and MM_Denormal)<>0 then
res:=216
res:=206
else
res:=207; {'Coprocessor Error'}
@ -122,7 +122,6 @@ procedure SignalToRunerror(sig : longint; SigInfo: PSigInfo; SigContext: PSigCon
{ clear top }
swd:=swd and not($3700);
end;
SysResetFPU;
end;
end;
SIGILL,

24
tests/webtbs/tw37926.pp Normal file
View File

@ -0,0 +1,24 @@
{$mode objfpc}
uses
sysutils,math;
procedure test(const s: single);
var
tempcode: integer;
sr: single;
begin
Val('8.077936E-28', sr, tempcode);
if sr <> s then
end;
var s, sr: single;
i, j, tempcode: Integer;
begin
for i := 1 to 5000 do begin
s := 0;
try
for j := 0 to Random(5) do s := s + Random(2) * power(2, Random(256) - 127);
except
on e: EMathError do s := 0; //continue;
end;
end;
end.