[fpc-devel] Attn Michael: r 43417 (ordinal bithelpers)

thaddy thaddy at localhost
Sun Nov 10 08:54:22 CET 2019

On 2019-11-08 22:33, Bart via fpc-devel wrote:
> Hi,
  > 2.
> A rather more serious issue.
> Compile time errors occur with e.g.
> ANativeInt.SetBit(High(TNativeIntBitIndex)) in modes tp (32-bit), fpc
> (32-bit), objfpc (32+64-bit) and delphi (32+64-bit)
> Range check error while evaluating constants (2147483648 must be
> between -2147483648 and 2147483647)
> Same error for AnInteger.SetBit(High(TIntegerBitIndex)) in modes
> objfpc (32-bit), delphi (32-bit) and macpas (32-bit)

I broke my brains and could not conclude anything else than a compiler 
bug in these cases: setting the sign bit is all I do and the bit 
patterns are all correct.
It seems that this is also confirmed. Anyway you suggestion to do the 
internals only as unsigned types makes sense if in that case the sign 
bit is respected.
Funny how such simple code - which it is - can have so much complexity.

More information about the fpc-devel mailing list