While looking into something else I noticed that because of the missing warn_logical_op check we do unnecessary work in warn_logical_operator, like calling fold_for_warn which can put stuff into cv/fold_cache etc. It also causes more noise when debugging.
Bootstrapped/regtested on x86_64-linux, ok for trunk? 2017-12-18 Marek Polacek <pola...@redhat.com> * c-warn.c (warn_logical_operator): Return early if -Wlogical-op is not in effect. --- gcc/c-family/c-warn.c +++ gcc/c-family/c-warn.c @@ -180,6 +180,9 @@ warn_logical_operator (location_t location, enum tree_code code, tree type, tree low0, low1, low, high0, high1, high, lhs, rhs, tem; bool strict_overflow_p = false; + if (!warn_logical_op) + return; + if (code != TRUTH_ANDIF_EXPR && code != TRUTH_AND_EXPR && code != TRUTH_ORIF_EXPR Marek