mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-09-13 21:11:23 +02:00
* don't insert type conversions in add nodes if both arguments are constant
and if the result does not depend on the types of the arguments (to prevent "qwordconst>int64const" being turned into "int64(qwordconst)>int64const" and thereby potentially change the outcome) (mantis #19622) git-svn-id: trunk@21395 -
This commit is contained in:
parent
9e0184884e
commit
a2426178dc
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12498,6 +12498,7 @@ tests/webtbs/tw19500.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw19511.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw19548.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw19555.pp svneol=native#text/pascal
|
||||
tests/webtbs/tw19622.pp -text svneol=native#text/plain
|
||||
tests/webtbs/tw1964.pp svneol=native#text/plain
|
||||
tests/webtbs/tw19651.pp svneol=native#text/plain
|
||||
tests/webtbs/tw19700.pp svneol=native#text/plain
|
||||
|
@ -1347,6 +1347,16 @@ implementation
|
||||
if (torddef(rd).ordtype<>scurrency) then
|
||||
inserttypeconv(right,s64currencytype);
|
||||
end
|
||||
{ leave some constant integer expressions alone in case the
|
||||
resultdef of the integer types doesn't influence the outcome,
|
||||
because the forced type conversions below can otherwise result
|
||||
in unexpected results (such as high(qword)<high(int64) returning
|
||||
true because high(qword) gets converted to int64) }
|
||||
else if is_integer(ld) and is_integer(rd) and
|
||||
(lt=ordconstn) and (rt=ordconstn) and
|
||||
(nodetype in [equaln,unequaln,gtn,gten,ltn,lten]) then
|
||||
begin
|
||||
end
|
||||
{ "and" does't care about the sign of integers }
|
||||
{ "xor", "or" and compares don't need extension to native int }
|
||||
{ size either as long as both values are signed or unsigned }
|
||||
|
33
tests/webtbs/tw19622.pp
Normal file
33
tests/webtbs/tw19622.pp
Normal file
@ -0,0 +1,33 @@
|
||||
Var a,b:qword;
|
||||
c:boolean;
|
||||
aa,bb:longword;
|
||||
Begin
|
||||
a:=qword($FFFFFFFFFFFFFFFF);
|
||||
b:=9223372036854775807;
|
||||
c:=a>b;
|
||||
if not c then
|
||||
halt(1);
|
||||
if not(qword($FFFFFFFFFFFFFFFF)>9223372036854775807) then
|
||||
halt(2);
|
||||
c:=qword($FFFFFFFFFFFFFFFF)>b;
|
||||
if not c then
|
||||
halt(3);
|
||||
c:=18446744073709551615>=9223372036854775807;
|
||||
if not c then
|
||||
halt(4);
|
||||
|
||||
|
||||
aa:=$FFFFFFFF;
|
||||
bb:=2147483647;
|
||||
c:=aa>bb;
|
||||
if not c then
|
||||
halt(5);
|
||||
if not ($FFFFFFFF>2147483647) then
|
||||
halt(6);
|
||||
c:=$FFFFFFFF>bb;
|
||||
if not c then
|
||||
halt(7);
|
||||
c:=4294967295>=2147483647;
|
||||
if not c then
|
||||
halt(8);
|
||||
End.
|
Loading…
Reference in New Issue
Block a user