Untyped hex-literal with (bit63 = 1) should be positive too
Original Reporter info from Mantis: nanobit @nanobit
-
Reporter name:
Original Reporter info from Mantis: nanobit @nanobit
- Reporter name:
Description:
Bug behaviour: Untyped hex-literal values with (bit63 = 1),
thus hex-literals in range [8000000000000000..
FFFFFFFFFFFFFFFF],
are interpreted as negative int64-values.
Correct behaviour would be:
[8000000000000000..
FFFFFFFFFFFFFFFF] should mean uint64 (like in Delphi).
See unsigned integer: https://www.freepascal.org/docs-html/ref/refse6.html
Current FPC already supports sufficient hex-notations for all int64 values:
- [-$8000000000000000..-$0000000000000001..$7FFFFFFFFFFFFFFF]
- [int64(
8000000000000000)..int64(
FFFFFFFFFFFFFFFF)..$7FFFFFFFFFFFFFFF]
Additionally, for convenience and Delphi compatible:
Support implicit typecast from hex-notated uint64 value to int64
if targettype int64 is declared explicitly.
For FPC users, the int64 compliance rule is very simple:
Typecast (bit63 = 1)-literals to represent int64 values in all compiler versions.
The new (bug-fixed) FPC needs to track this in wiki FPC_User_Changes:
Typecast old (bit63 = 1)-literals to get compliant with new FPC.
Forum thread with more details and about Delphi compatibility:
https://forum.lazarus.freepascal.org/index.php/topic,50968.0.html
Mantis conversion info:
- Mantis ID: 37757
- OS: Windows
- OS Build: 10
- Platform: win32
- Version: 3.2.0
- Monitored by: » @dmz73 (dmz73)