{: test succ range error causes a fatal error }

{d+}
program d1010( output );

var
   k : integer;
   x : real;

function side : integer;
begin
   side := k;
   k := k+1;
end;
begin {d1010}

   k := 13;
   if succ( side, 1 ) <> 14 then
      writeln( 'succ error 1' );
   if k <> 14 then
      writeln( 'succ error 2' );
   k := 13;
   if succ( 1, side ) <> 14 then
      writeln( 'succ error 3' );
   if k <> 14 then
      writeln( 'succ error 4' );
   if succ(maxint-1, 1) <> maxint then
      writeln( 'succ error 5' );
   if succ(1, maxint-1) <> maxint then
      writeln( 'succ error 6' );

   if (succ( maxint, 1 ) = 0) or true then
      writeln( 'fails: succ range error is not detected' );
end. { d1010 }

