* AArch64: avoid false overflow error in case of -2^63+0

This commit is contained in:
florian 2024-03-24 12:36:02 +01:00
parent cf6b38c35f
commit 1fccfd3ee1
2 changed files with 11 additions and 28 deletions

View File

@ -1436,7 +1436,9 @@ implementation
begin
{ add/sub instructions have only positive immediate operands }
if (op in [OP_ADD,OP_SUB]) and
(a<0) then
(a<0) and
{ this might result in a false positive overflow in case of a+0 }
(a<>$8000000000000000) then
begin
if op=OP_ADD then
op:=op_SUB

View File

@ -1,28 +1,9 @@
var
yy,res : longint;
{$mode objfpc}
{$Q+}
uses
Sysutils;
begin
res:=0;
yy:=random(0)+1980;
If (yy<1980) or (yy>2099) then
res:=1;
if res<>0 then
halt(res);
yy:=random(0)+2099;
If (yy<1980) or (yy>2099) then
res:=2;
if res<>0 then
halt(res);
yy:=random(0)+1980;
If (yy<=1979) or (yy>2099) then
res:=3;
if res<>0 then
halt(res);
yy:=random(0)+2099;
If (yy<1979) or (yy>=2100) then
res:=4;
if res<>0 then
halt(res);
end.
writeln(Int64.MinValue+Int64(Random(0)));
end.