{: test that arithmetic overflow causes a fatal error }

{$d+}
program d098( output );

var
   k : integer;

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

   k := 10;
   writeln( '-10*10 is ', -10*side:1);
   if k <> 11 then
      writeln( 'multiply operator for debug has side effects' );

   {$d-}
   k := -maxint; k := k - 1;   { test valid if this doesn't overflow }
   {$d+}
   if k > 0 then
      writeln( 'test is not valid' )
   else
      writeln( k:1, '*(-1) is ', (-1)*k );

   writeln( 'fails: overflow in multiply operator error is not detected' );
end. { d098 }

