[fpc-pascal] Range checks

Jonas Maebe jonas at freepascal.org
Sat Jan 27 17:05:33 CET 2018


C Western wrote:
> The following innocuous looking code generates a range check error:
>
> {$R+}
> function Count: qword;
> begin
>   Result := 0;
> end;
> var
>   i: Integer;
> begin
>   for i := 0 to Count-1 do
>     WriteLn(i);
> end.
>
> I can (more or less) see why

I changed the type used to evaluate for-loop bounds in ISO Pascal mode
because of https://bugs.freepascal.org/view.php?id=24318 . Maybe the
same should be done for other non-TP/Delphi modes too.


Jonas



More information about the fpc-pascal mailing list