Int64 mod high Int64 Value generates wrong "exceeds 32-bit bound" ASM error at x86-64 target
Original Reporter info from Mantis: benjamin@0ok.de @bero1985
-
Reporter name: Benjamin Rosseaux
Original Reporter info from Mantis: benjamin@0ok.de @bero1985
- Reporter name: Benjamin Rosseaux
Description:
Int64 mod high Int64 Value generates wrong "exceeds 32-bit bound" ASM error at any x86-64 target
Example source:
program int64modint64bug;
{$mode delphi}
const
a = int64($100000000);
var
b: int64 = 123;
c: int64;
begin
c := b mod a;
if c <> 0 then
begin
end;
end.
Example output:
Free Pascal Compiler version 3.3.1 [2020/11/26] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
Target OS: Win64 for x64
Compiling int64modint64bug.pas
int64modint64bug.pas(11,10) Error: Asm: signed dword value exceeds bounds -4294967296
int64modint64bug.pas(15,1) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Steps to reproduce:
Compile it for any x86-64 target with the internal assembler (without -Aas)