diff --git a/gcc/c-family/ChangeLog b/gcc/c-family/ChangeLog
index accb9850074cebf3d427fa85409227585d18399e..52a7f5c9a4077a9b8536bbae622c01bd5253bc78 100644
--- a/gcc/c-family/ChangeLog
+++ b/gcc/c-family/ChangeLog
@@ -1,3 +1,9 @@
+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.
+
 2012-05-05  Manuel López-Ibáñez  <manu@gcc.gnu.org>
 
 	PR c/43772
diff --git a/gcc/c-family/c-common.c b/gcc/c-family/c-common.c
index 04a265f97db00aa901cdf04a62a95ef618926130..1cdef9a995c3c3a200ece7aec4d93ea8e5fbdb7a 100644
--- a/gcc/c-family/c-common.c
+++ b/gcc/c-family/c-common.c
@@ -1629,7 +1629,7 @@ warn_logical_operator (location_t location, enum tree_code code, tree type,
     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);
@@ -1644,7 +1644,7 @@ warn_logical_operator (location_t location, enum tree_code code, tree type,
     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