INC, DEC routines resulted wrong values
Original Reporter info from Mantis: hoangle
-
Reporter name: Lê Minh Hoàng
Original Reporter info from Mantis: hoangle
- Reporter name: Lê Minh Hoàng
Description:
Inc(a, b) and Dec(a, b) resulted wrong values if
- a is an int64 variable
- b is an int64 constant greater than MaxLongInt
This bug does not appear in previous versions. It is very dangerous for the contestants in programming contests.
Steps to reproduce:
var
a, b: Int64;
begin
a := 1; b := 10000000000; //10^10
Inc(a, b);
WriteLn(a); //Write out 1410065409
a := 1; b := 10000000000; //10^10
a := a + b;
WriteLn(a); //Write out 10000000001
end.
Mantis conversion info:
- Mantis ID: 18249
- OS: Windows
- OS Build: 7
- Platform: PC
- Version: 2.4.2
- Fixed in version: 2.6.0
- Fixed in revision: 16289 (#8ca3c830)