http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43772
--- Comment #13 from Marc Glisse <marc.glisse at normalesup dot org> 2012-04-28 12:40:14 UTC --- (In reply to comment #10) > But there is something strange, because it is warning "it is always false", > which is obviously not true. So I think at some moment it is doing some > transformation we don't want to do. It notices that it should warn, and unless one of the first ranges is trivial (a case it forgot), with an operator &&, the only warning that makes sense is that it is always false. It never shows that it is false, it is just a bit hasty in deciding which warning to pick. And indeed the "logical and...always true" sentence does not exist, because it doesn't make sense. (In reply to comment #11) > (In reply to comment #9) > > It forgets to check first whether the first 2 ranges are trivial. > Or easier, instead of checking: > if (TREE_CODE (tem) != INTEGER_CST) > it could check integer_onep(tem) or integer_zerop(tem) depending on or_op. Or > build a tree integer constant from or_op and tree_int_cst_equal it to tem. Except that this version would warn for x<INT_MIN && x>INT_MAX, whereas this belongs to other warnings. So testing the triviality of the first ranges seems best.