The return value of build_range_check can be NULL and integer_zerop
cannot handle that. Bootstrapped and regression tested. John David
Anglin tested that it fixes the ICE in hppa. Committed to mainline as
obvious.

2012-05-09  Manuel López-Ibáñez  <m...@gcc.gnu.org>

        PR c++/53261
        * c-common.c (warn_logical_operator): Check that argument of
        integer_zerop is not NULL.

Index: gcc/c-family/c-common.c
===================================================================
--- gcc/c-family/c-common.c     (revision 187257)
+++ gcc/c-family/c-common.c     (working copy)
@@ -1627,11 +1627,11 @@ warn_logical_operator (location_t locati
      should be always false to get a warning.  */
   if (or_op)
     in0_p = !in0_p;

   tem = build_range_check (UNKNOWN_LOCATION, type, lhs, in0_p, low0, high0);
-  if (integer_zerop (tem))
+  if (tem && integer_zerop (tem))
     return;

   rhs = make_range (op_right, &in1_p, &low1, &high1, &strict_overflow_p);
   if (!rhs)
     return;
@@ -1642,11 +1642,11 @@ warn_logical_operator (location_t locati
      should be always false to get a warning.  */
   if (or_op)
     in1_p = !in1_p;

   tem = build_range_check (UNKNOWN_LOCATION, type, rhs, in1_p, low1, high1);
-  if (integer_zerop (tem))
+  if (tem && integer_zerop (tem))
     return;

   /* If both expressions have the same operand, if we can merge the
      ranges, and if the range test is always false, then warn.  */
   if (operand_equal_p (lhs, rhs, 0)

Reply via email to