mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-10-29 12:22:35 +01:00
* correctly change the signdness information of tordconstnodes that are
simplified via typeconvnode (corrects resultdef of "qword(1) shl 33",
mantis #22133)
* simplify shl/shr nodes after their resultdef has been set, so the
resultdef used during simplify is set (fixes same expression as above
when it is calculated by an inline function)
git-svn-id: trunk@21394 -
This commit is contained in:
parent
baa8fa39a8
commit
9e0184884e
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -12615,6 +12615,7 @@ tests/webtbs/tw2196.pp svneol=native#text/plain
|
|||||||
tests/webtbs/tw2197.pp svneol=native#text/plain
|
tests/webtbs/tw2197.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2198.pp svneol=native#text/plain
|
tests/webtbs/tw2198.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2210.pp svneol=native#text/plain
|
tests/webtbs/tw2210.pp svneol=native#text/plain
|
||||||
|
tests/webtbs/tw22133.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2214.pp svneol=native#text/plain
|
tests/webtbs/tw2214.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2220.pp svneol=native#text/plain
|
tests/webtbs/tw2220.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw2226.pp svneol=native#text/plain
|
tests/webtbs/tw2226.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -2699,6 +2699,10 @@ implementation
|
|||||||
testrange(resultdef,tordconstnode(left).value,(nf_explicit in flags),false);
|
testrange(resultdef,tordconstnode(left).value,(nf_explicit in flags),false);
|
||||||
left.resultdef:=resultdef;
|
left.resultdef:=resultdef;
|
||||||
tordconstnode(left).typedef:=resultdef;
|
tordconstnode(left).typedef:=resultdef;
|
||||||
|
if is_signed(resultdef) then
|
||||||
|
tordconstnode(left).value.signed:=true
|
||||||
|
else
|
||||||
|
tordconstnode(left).value.signed:=false;
|
||||||
result:=left;
|
result:=left;
|
||||||
left:=nil;
|
left:=nil;
|
||||||
exit;
|
exit;
|
||||||
|
|||||||
@ -590,10 +590,6 @@ implementation
|
|||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
result:=simplify(false);
|
|
||||||
if assigned(result) then
|
|
||||||
exit;
|
|
||||||
|
|
||||||
{$ifdef cpunodefaultint}
|
{$ifdef cpunodefaultint}
|
||||||
{ for small cpus we use the smallest common type }
|
{ for small cpus we use the smallest common type }
|
||||||
if (left.resultdef.typ=orddef) and (right.resultdef.typ=orddef) then
|
if (left.resultdef.typ=orddef) and (right.resultdef.typ=orddef) then
|
||||||
@ -632,6 +628,10 @@ implementation
|
|||||||
{$endif cpunodefaultint}
|
{$endif cpunodefaultint}
|
||||||
|
|
||||||
resultdef:=left.resultdef;
|
resultdef:=left.resultdef;
|
||||||
|
|
||||||
|
result:=simplify(false);
|
||||||
|
if assigned(result) then
|
||||||
|
exit;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
32
tests/webtbs/tw22133.pp
Normal file
32
tests/webtbs/tw22133.pp
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
program tw22133;
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
type
|
||||||
|
uint64 = qword;
|
||||||
|
|
||||||
|
var
|
||||||
|
T64:UInt64;
|
||||||
|
|
||||||
|
//force checking constants in compile-time
|
||||||
|
{$RANGECHECKS ON}
|
||||||
|
|
||||||
|
{$inline on}
|
||||||
|
|
||||||
|
function testshift(a:uint64; b: byte): uint64; inline;
|
||||||
|
begin
|
||||||
|
result:=a shl b;
|
||||||
|
end;
|
||||||
|
|
||||||
|
begin
|
||||||
|
T64:=UInt64(1 shl 63);
|
||||||
|
if T64<>uint64(high(int64)+1) then
|
||||||
|
halt(1);
|
||||||
|
T64:=UInt64(1) shl 63;
|
||||||
|
if T64<>uint64(high(int64)+1) then
|
||||||
|
halt(2);
|
||||||
|
T64:=testshift(1,63);
|
||||||
|
if T64<>uint64(high(int64)+1) then
|
||||||
|
halt(3);
|
||||||
|
end.
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user