Skip to content

Range Check gives false positive with ZeroBasedStrings enabled

With the default debug mode in Lazarus the following example program with ZeroBasedStrings raises a false positive range check error:

program project1;

{$mode objfpc}{$H+}
{$ZeroBasedStrings On}

uses sysutils;

var
  S: String = 'Cat';
begin
  S[0] := 'H';
  WriteLn(S);
end.

RangeCheckFalsePositive.zip

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information