Calculation and range-check error on calculation with lowest possible Int64-value
Original Reporter info from Mantis: Joost
-
Reporter name: Joost van der Sluis
Original Reporter info from Mantis: Joost
- Reporter name: Joost van der Sluis
Description:
Following test-program writes a different value for '1-I' and '-I+1' when I is the maximum value allowed for an Int64. Maybe the compiler converts (-I+1) to -(I+1) which would indeed resolves in a range-check problem...?
program TestRC;
{$R+}
var Li : Int64;
const I = $7fffffffffffffff;
begin
writeln(-I);
writeln(1-I);
writeln(-I+1);
Li := -I;
Li := 1-I;
// Uncomment next line and you'll get a ranche-check error
// Li
Mantis conversion info:
- Mantis ID: 11216
- Version: 2.3.1
- Fixed in version: 2.4.0
- Fixed in revision: 10808 (#2413d4b4)