* float operations can have an exception as a side effect, resolves #37398

git-svn-id: trunk@45824 -
This commit is contained in:
florian 2020-07-21 20:09:39 +00:00
parent dd6e6eb26a
commit 5da913de0e
3 changed files with 16 additions and 1 deletions

1
.gitattributes vendored
View File

@ -18382,6 +18382,7 @@ tests/webtbs/tw37323.pp svneol=native#text/pascal
tests/webtbs/tw37339.pp svneol=native#text/pascal
tests/webtbs/tw37393.pp svneol=native#text/pascal
tests/webtbs/tw37397.pp svneol=native#text/plain
tests/webtbs/tw37398.pp svneol=native#text/pascal
tests/webtbs/tw3742.pp svneol=native#text/plain
tests/webtbs/tw3751.pp svneol=native#text/plain
tests/webtbs/tw3758.pp svneol=native#text/plain

View File

@ -1427,7 +1427,9 @@ implementation
((mhs_exceptions in pmhs_flags(arg)^) and
((n.nodetype in [derefn,vecn,divn,slashn]) or
((n.nodetype=subscriptn) and is_implicit_pointer_object_type(tsubscriptnode(n).left.resultdef)) or
((n.nodetype in [addn,subn,muln,unaryminusn]) and (n.localswitches*[cs_check_overflow,cs_check_range]<>[]))
((n.nodetype in [addn,subn,muln,unaryminusn]) and (n.localswitches*[cs_check_overflow,cs_check_range]<>[])) or
{ float operations could throw an exception }
((n.nodetype in [addn,subn,muln,slashn,unaryminusn,equaln,unequaln,gten,gtn,lten,ltn]) and is_real_or_cextended(tunarynode(n).left.resultdef))
)
) or
((n.nodetype=loadn) and

12
tests/webtbs/tw37398.pp Normal file
View File

@ -0,0 +1,12 @@
program testnan;
{$mode objfpc}{$H+}
uses math;
var d: double;
temp: Boolean;
begin
d := NaN;
temp := IsNan(d) or (d = 0);
writeln(temp);
end.