Skip to content

FPC 3.3.1 Compiler: Integer Expr Caculating Error

1  function HSCtoGroupID(const gm: TGroupMode; const hsc: UInt64): Integer;
2  var
3    gid: Integer;
4  begin
5    if hsc > 100000000 then  
6      gid := (hsc div 100000000) and $000000FF 
7    else     
8      gid := hsc div 100000000;
  • With FPC 3.3.1 (codetyphon 7.70): gid return a error value when "hsc > $FFFFFFFF"
  • With FPC 3.2.2(Lazarus 2.2.0): non error

but,

if the line 3 change to "gid: Int64", or 
   the line 6 change to "gid := (hsc div 100000000) and Int64($000000FF)", or 
                        "hsc div 100000000", 

non error

Edited by uvwx413
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information