Overflow checks and range checks don't get applied to Integer or PtrUInt in the 64bit compiler.
Original Reporter info from Mantis: Hixie
-
Reporter name: Ian Hickson
Original Reporter info from Mantis: Hixie
- Reporter name: Ian Hickson
Description:
Overflow checks and range checks don't get applied to Integer or PtrUInt in the 64bit compiler.
{$MODE OBJFPC}
{$OVERFLOWCHECKS ON}
{$RANGECHECKS ON}
program test;
uses exceptions;
var I, J: PtrUInt; // try also with Integer or Cardinal; compare with Byte or Word
begin
try
J := 1;
Writeln(0, ' ', J);
for I := 1 to 65 do
begin
J := J shl 1;
Writeln(I, ' ', J);
end;
except
ReportCurrentException();
end;
end.
Additional information:
I got downstream reports that with the 32 bit compiler, you do get range checks for Cardinal, at least.
Mantis conversion info:
- Mantis ID: 28384
- OS: Linux
- Build: 2015/07/06
- Platform: x86_64
- Version: 3.1.1