* compare floating point default parameter values bytewise instead of as

floating point values, so that NaNs can also be compared (mantis #30299)

git-svn-id: trunk@34597 -
This commit is contained in:
Jonas Maebe 2016-10-02 12:56:49 +00:00
parent f5973eaddd
commit 94d7a7274b
4 changed files with 21 additions and 4 deletions

1
.gitattributes vendored
View File

@ -15219,6 +15219,7 @@ tests/webtbs/tw30208.pp svneol=native#text/pascal
tests/webtbs/tw3023.pp svneol=native#text/plain
tests/webtbs/tw30240.pp svneol=native#text/plain
tests/webtbs/tw3028.pp svneol=native#text/plain
tests/webtbs/tw30299.pp svneol=native#text/plain
tests/webtbs/tw30310.pp svneol=native#text/plain
tests/webtbs/tw30329.pp -text svneol=native#text/plain
tests/webtbs/tw30357.pp svneol=native#text/pascal

View File

@ -2181,7 +2181,7 @@ implementation
if assigned(currpara1.defaultconstsym) and
assigned(currpara2.defaultconstsym) then
begin
if not equal_constsym(tconstsym(currpara1.defaultconstsym),tconstsym(currpara2.defaultconstsym)) then
if not equal_constsym(tconstsym(currpara1.defaultconstsym),tconstsym(currpara2.defaultconstsym),true) then
exit;
end
{ cannot have that the second (= implementation) has a default value declared and the

View File

@ -30,7 +30,7 @@ interface
function is_funcret_sym(p:TSymEntry):boolean;
function equal_constsym(sym1,sym2:tconstsym):boolean;
function equal_constsym(sym1,sym2:tconstsym; nanequal: boolean):boolean;
implementation
@ -48,7 +48,7 @@ implementation
end;
function equal_constsym(sym1,sym2:tconstsym):boolean;
function equal_constsym(sym1,sym2:tconstsym; nanequal: boolean):boolean;
var
p1,p2,pend : pchar;
begin
@ -85,7 +85,10 @@ implementation
equal_constsym:=true;
end;
constreal :
equal_constsym:=(pbestreal(sym1.value.valueptr)^=pbestreal(sym2.value.valueptr)^);
if nanequal then
equal_constsym:=CompareByte(pbestreal(sym1.value.valueptr)^,pbestreal(sym2.value.valueptr)^,sizeof(pbestreal^))=0
else
equal_constsym:=pbestreal(sym1.value.valueptr)^=pbestreal(sym2.value.valueptr)^;
constset :
equal_constsym:=(pnormalset(sym1.value.valueptr)^=pnormalset(sym2.value.valueptr)^);
constnil :

13
tests/webtbs/tw30299.pp Normal file
View File

@ -0,0 +1,13 @@
{ %norun }
{$mode objfpc}
uses math;
procedure test(s: single = NaN); forward;
procedure test(s: single = NaN);
begin
end;
begin
end.