diff mbox

[committed] Fix PR c++/52361 ICE in tree_strip_nop_conversions

Message ID CAESRpQDpuCqFdNQBc2-9Jun=TB1TQPxEbLXspX0M1w3=-jdQ0Q@mail.gmail.com
State New
Headers show

Commit Message

Manuel López-Ibáñez May 8, 2012, 10:16 p.m. UTC
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  <manu@gcc.gnu.org>

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

Patch

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)