mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-28 16:40:28 +02:00
* AArch64: avoid false overflow error in case of -2^63+0
This commit is contained in:
parent
cf6b38c35f
commit
1fccfd3ee1
@ -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
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user