[fpc-pascal] looks like a bug
Peter Blackman
peter at pblackman.plus.com
Tue Oct 20 23:17:54 CEST 2026
On 19/10/2026 01:45, P Padil via fpc-pascal wrote:
> I set a small array and the program below is ok to go out of bounds.
>
> —
> program test;
>
> type
> tarr = array of array of boolean;
>
> var
> exa : tarr = ((false,false,true,true),(false,false,true,true),
> (true,true,false,true), (true,true,true,false));
>
> begin
> writeln(exa[0,0],', ',exa[4,4]);
> writeln(low(exa),', ',high(exa));
> writeln(low(exa[4]),', ',high(exa[4]));
> end.
As its a dynamic array, I would use SetLength on it,
before assigning to its elements.
Cheers,
Peter
More information about the fpc-pascal
mailing list