>       * fold-const.c (fold_binary_loc): Move simplifying of comparisons
>       against the highest or lowest possible integer ...
>       * match.pd: ... as patterns here.

This incorrectly dropped the calls to omit_one_operand_loc, resulting in the 
failure of the attached Ada test: if the operand has side effects, you cannot 
replace the entire comparison with just 'true' or 'false'.


        * gnat.dg/overflow_sum3.adb: New test.

-- 
Eric Botcazou
--  { dg-do run }
--  { dg-options "-gnato" }

procedure Overflow_Sum3 is

   function Ident (I : Integer) return Integer is
   begin
      return I;
   end;

   X : Short_Short_Integer := Short_Short_Integer (Ident (127));

begin
   if X+1 <= 127 then
      raise Program_Error;
   end if;
exception
   when Constraint_Error => null;
end;

Reply via email to