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

{$d+}
program d010( output );

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

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

   k := -3;
   writeln( 'ai[', k:1, '] is ', ai[k]:1 );
end. { d010 }

