https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80199
Martin Sebor <msebor at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Keywords| |diagnostic Status|UNCONFIRMED |NEW Last reconfirmed| |2017-03-26 CC| |msebor at gcc dot gnu.org Ever confirmed|0 |1 --- Comment #1 from Martin Sebor <msebor at gcc dot gnu.org> --- The implementation of the warning relies on the make_range function which in, in turn, calls make_range_step. As the comment indicates copied below, make_range_step has no support for floating point values and so it doesn't simplify the comparison involving floating point expressions the same way it does one with integers. This in turn prevents the warn_logical_operator function that implements the warning from detecting that the result is always false. It seems this should be doable in the constant propagation pass that is able to figure this out for floats. I'll confirm it on that basis. make_range_step (location_t loc, enum tree_code code, tree arg0, tree arg1, tree exp_type, tree *p_low, tree *p_high, int *p_in_p, bool *strict_overflow_p) { ... case EQ_EXPR: case NE_EXPR: case LT_EXPR: case LE_EXPR: case GE_EXPR: case GT_EXPR: /* We can only do something if the range is testing for zero and if the second operand is an integer constant. Note that saying something is "in" the range we make is done by complementing IN_P since it will set in the initial case of being not equal to zero; "out" is leaving it alone. */ if (low == NULL_TREE || high == NULL_TREE