------- Comment #5 from manu at gcc dot gnu dot org 2009-05-17 17:11 ------- This patch seems to fix the problem and still warn for the interesting cases. Could you all test it in your targets? I can only test x86-64-unknown-linux-gnu.
Index: gcc/c-common.c =================================================================== --- gcc/c-common.c (revision 147636) +++ gcc/c-common.c (working copy) @@ -1782,14 +1782,12 @@ warn_logical_operator (location_t locati again at the end. */ if (or_op) in0_p = !in0_p, in1_p = !in1_p; /* If both expressions are the same, if we can merge the ranges, and we - can build the range test, return it or it inverted. If one of the - ranges is always true or always false, consider it to be the same - expression as the other. */ - if ((lhs == 0 || rhs == 0 || operand_equal_p (lhs, rhs, 0)) + can build the range test, return it or it inverted. */ + if (lhs && rhs && operand_equal_p (lhs, rhs, 0) && merge_ranges (&in_p, &low, &high, in0_p, low0, high0, in1_p, low1, high1) && 0 != (tem = build_range_check (type, lhs != 0 ? lhs : rhs != 0 ? rhs : integer_zero_node, -- manu at gcc dot gnu dot org changed: What |Removed |Added ---------------------------------------------------------------------------- Status|UNCONFIRMED |NEW Ever Confirmed|0 |1 Last reconfirmed|0000-00-00 00:00:00 |2009-05-17 17:11:44 date| | http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40172