mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-05 13:29:25 +01:00
* fixed range test optimization for signed types and enabled it for them
git-svn-id: trunk@42332 -
This commit is contained in:
parent
b270b0f7f0
commit
40082100e1
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -16615,6 +16615,7 @@ tests/webtbs/tw34332.pp svneol=native#text/pascal
|
|||||||
tests/webtbs/tw3435.pp svneol=native#text/plain
|
tests/webtbs/tw3435.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw34380.pp svneol=native#text/plain
|
tests/webtbs/tw34380.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw34385.pp svneol=native#text/plain
|
tests/webtbs/tw34385.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw34385a.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3441.pp svneol=native#text/plain
|
tests/webtbs/tw3441.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3443.pp svneol=native#text/plain
|
tests/webtbs/tw3443.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw34438.pp svneol=native#text/pascal
|
tests/webtbs/tw34438.pp svneol=native#text/pascal
|
||||||
|
|||||||
@ -389,7 +389,7 @@ implementation
|
|||||||
var
|
var
|
||||||
swapl, swapr: Boolean;
|
swapl, swapr: Boolean;
|
||||||
valuer: tnode;
|
valuer: tnode;
|
||||||
t: QWord;
|
t: Tconstexprint;
|
||||||
begin
|
begin
|
||||||
result:=false;
|
result:=false;
|
||||||
swapl:=false;
|
swapl:=false;
|
||||||
@ -398,29 +398,26 @@ implementation
|
|||||||
if nodel.left.nodetype=ordconstn then
|
if nodel.left.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
swapl:=true;
|
swapl:=true;
|
||||||
cl:=tordconstnode(nodel.left).value.uvalue;
|
cl:=tordconstnode(nodel.left).value;
|
||||||
value:=nodel.right;
|
value:=nodel.right;
|
||||||
end
|
end
|
||||||
else if nodel.right.nodetype=ordconstn then
|
else if nodel.right.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
cl:=tordconstnode(nodel.right).value.uvalue;
|
cl:=tordconstnode(nodel.right).value;
|
||||||
value:=nodel.left;
|
value:=nodel.left;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
exit;
|
exit;
|
||||||
|
|
||||||
if is_signed(value.resultdef) then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
if noder.left.nodetype=ordconstn then
|
if noder.left.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
swapl:=true;
|
swapl:=true;
|
||||||
cr:=tordconstnode(noder.left).value.uvalue;
|
cr:=tordconstnode(noder.left).value;
|
||||||
valuer:=noder.right;
|
valuer:=noder.right;
|
||||||
end
|
end
|
||||||
else if noder.right.nodetype=ordconstn then
|
else if noder.right.nodetype=ordconstn then
|
||||||
begin
|
begin
|
||||||
cr:=tordconstnode(noder.right).value.uvalue;
|
cr:=tordconstnode(noder.right).value;
|
||||||
valuer:=noder.left;
|
valuer:=noder.left;
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
|
|||||||
33
tests/webtbs/tw34385a.pp
Normal file
33
tests/webtbs/tw34385a.pp
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
{$r+}
|
||||||
|
|
||||||
|
program rangeTest;
|
||||||
|
const
|
||||||
|
w : longint = 123;
|
||||||
|
n : longint = 48;
|
||||||
|
m : longint = -5;
|
||||||
|
k : longint = low(longint);
|
||||||
|
begin
|
||||||
|
if (w<=1) and (w>=10) then
|
||||||
|
halt(1);
|
||||||
|
|
||||||
|
if (w>=1) and (w<=1000) then
|
||||||
|
else
|
||||||
|
halt(2);
|
||||||
|
|
||||||
|
if (n>44)and(n<48) then
|
||||||
|
halt(3);
|
||||||
|
|
||||||
|
if (m>=-4) and (m<=$7ffffffe) then
|
||||||
|
halt(4);
|
||||||
|
|
||||||
|
if (m>=-5) and (m<=$7ffffffe) then
|
||||||
|
else
|
||||||
|
halt(5);
|
||||||
|
|
||||||
|
if (m>=-$7fffffff) and (m<=$7ffffffe) then
|
||||||
|
else
|
||||||
|
halt(6);
|
||||||
|
|
||||||
|
if (k>=-$7fffffff) and (k<=$7ffffffe) then
|
||||||
|
halt(7);
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user