{: test pred range error causes a fatal error }

{d+}
program d1013( output );

var
   k : integer;
   x : real;

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

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

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

