{: test that chr(n) causes a fatal error if it overflows }

{$d+}
program d027( output );
const
   maxTryChar =  1000;
var
   n :  integer;
function side : integer;
begin
   side := n;
   n := n-1;
end;
begin {d027}
   n := 1;
   write( chr(side) );
   if n <> 0 then
      writeln( 'side effect error evaluating chr()' );
   while n >= -maxTryChar do begin
      write( chr(n) );     { should overflow eventually }
      n := n-1;
      if n mod 80 = 0 then
         writeln;
   end;
end. { d027 }
