mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-12 18:49:16 +02:00
* 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:
parent
f5973eaddd
commit
94d7a7274b
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -15219,6 +15219,7 @@ tests/webtbs/tw30208.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw3023.pp svneol=native#text/plain
|
tests/webtbs/tw3023.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw30240.pp svneol=native#text/plain
|
tests/webtbs/tw30240.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3028.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/tw30310.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw30329.pp -text svneol=native#text/plain
|
tests/webtbs/tw30329.pp -text svneol=native#text/plain
|
||||||
tests/webtbs/tw30357.pp svneol=native#text/pascal
|
tests/webtbs/tw30357.pp svneol=native#text/pascal
|
||||||
|
@ -2181,7 +2181,7 @@ implementation
|
|||||||
if assigned(currpara1.defaultconstsym) and
|
if assigned(currpara1.defaultconstsym) and
|
||||||
assigned(currpara2.defaultconstsym) then
|
assigned(currpara2.defaultconstsym) then
|
||||||
begin
|
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;
|
exit;
|
||||||
end
|
end
|
||||||
{ cannot have that the second (= implementation) has a default value declared and the
|
{ cannot have that the second (= implementation) has a default value declared and the
|
||||||
|
@ -30,7 +30,7 @@ interface
|
|||||||
|
|
||||||
function is_funcret_sym(p:TSymEntry):boolean;
|
function is_funcret_sym(p:TSymEntry):boolean;
|
||||||
|
|
||||||
function equal_constsym(sym1,sym2:tconstsym):boolean;
|
function equal_constsym(sym1,sym2:tconstsym; nanequal: boolean):boolean;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
@ -48,7 +48,7 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
function equal_constsym(sym1,sym2:tconstsym):boolean;
|
function equal_constsym(sym1,sym2:tconstsym; nanequal: boolean):boolean;
|
||||||
var
|
var
|
||||||
p1,p2,pend : pchar;
|
p1,p2,pend : pchar;
|
||||||
begin
|
begin
|
||||||
@ -85,7 +85,10 @@ implementation
|
|||||||
equal_constsym:=true;
|
equal_constsym:=true;
|
||||||
end;
|
end;
|
||||||
constreal :
|
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 :
|
constset :
|
||||||
equal_constsym:=(pnormalset(sym1.value.valueptr)^=pnormalset(sym2.value.valueptr)^);
|
equal_constsym:=(pnormalset(sym1.value.valueptr)^=pnormalset(sym2.value.valueptr)^);
|
||||||
constnil :
|
constnil :
|
||||||
|
13
tests/webtbs/tw30299.pp
Normal file
13
tests/webtbs/tw30299.pp
Normal 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.
|
Loading…
Reference in New Issue
Block a user