* fixed constant evaluation check for negvalue+posvalue (mantis #11216)

git-svn-id: trunk@10808 -
This commit is contained in:
Jonas Maebe 2008-04-26 21:22:08 +00:00
parent 6714fbc056
commit 2413d4b43f
3 changed files with 23 additions and 1 deletions

1
.gitattributes vendored
View File

@ -8144,6 +8144,7 @@ tests/webtbs/tw1111.pp svneol=native#text/plain
tests/webtbs/tw11139.pp svneol=native#text/plain
tests/webtbs/tw11169.pp svneol=native#text/plain
tests/webtbs/tw1117.pp svneol=native#text/plain
tests/webtbs/tw11216.pp svneol=native#text/plain
tests/webtbs/tw1122.pp svneol=native#text/plain
tests/webtbs/tw1123.pp svneol=native#text/plain
tests/webtbs/tw1124.pp svneol=native#text/plain

View File

@ -160,7 +160,7 @@ begin
{Try if the result fits in an int64.}
if (a.signed) and (a.svalue<0) then
{$Q-}
sspace:=qword(high(int64))-qword(-a.svalue)
sspace:=qword(high(int64))+qword(-a.svalue)
{$ifdef ena_q}{$Q+}{$endif}
else if not a.signed and (a.uvalue>qword(high(int64))) then
goto try_qword

21
tests/webtbs/tw11216.pp Normal file
View File

@ -0,0 +1,21 @@
program TestRC;
{$R+}
var Li, Lj : Int64;
const I = $7fffffffffffffff;
begin
if (1-I)<>(-I+1) then
halt(1);
writeln(1-I);
writeln(-I+1);
Li := 1-I;
Lj := -I + 1;
if Li<>Lj then
halt(2);
if (Li<>-9223372036854775806) then
halt(3);
end.