Unwanted arithmetic overflow.
Original Reporter info from Mantis: DonAlfredo @DonAlfredo
-
Reporter name: Alfred
Original Reporter info from Mantis: DonAlfredo @DonAlfredo
- Reporter name: Alfred
Description:
FPC errors out with an arithmetic overflow when doing an simple Int64 multiplication.
program Project1;
{$mode objfpc}{$H+}
{$R+,Q+,S+,T+}
var
x,y,z:integer;
begin
x:=0;
z:=0;
// all ok
y:=Int64(x-1);
writeln(y);
// all ok
y:=Int64(z);
writeln(y);
// arithmetic overflow
y:=Int64(x-1)*Int64(z);
writeln(y);
readln;
end.
The statement above looks strange, but is used in the Lazarus source:
components/synedit/syngutterlineoverview.pp
Perhaps it is related also with errors that are encountered with simple Inc() and Dec() statements in Lazarus on aarch64. But I will check that again after this (statement/bug) has been evaluated.
Assembler is included.
Additional information:
Lazarus does not yet work 100% on Aarch64.
Which is to be expected.
I am trying to isolate the problems one by one.
Splitting between Lazarus and FPC.
AFAIK, this is the first FPC one.
Mantis conversion info:
- Mantis ID: 29912
- OS: Linux
- OS Build: Linux Arch 64
- Build: REV 33356
- Platform: Odroid-C2
- Version: 3.1.1
- Fixed in version: 3.1.1
- Fixed in revision: 33380 (#322493c1)