
{: test that out of bounds array index causes a fatal error }

{$d+}
program d011( output );

var
   ai : array[-2..10] of integer;

   k  : integer;

function side : integer;
begin
   side := k;
   k := k+1;
end;
begin {d011}
   k := 10;
   ai[side] := 6;
   if k <> 11 then
      writeln( 'side effect error evaluating array index' );

   k := 11;
   writeln( 'ai[', k:1, '] is ', ai[k]:1 );
end. { d011 }

