This patch fixes almost all false positives in PR43772. The case not fixed is:

  intmax_t i = (whatever);
  if (INT_MAX < i && i <= LONG_MAX)
     print ("i is in 'long' but not 'int' ran")

where we warn if INT_MAX = LONG_MAX < INTMAX_MAX.  Perhaps with the
macro location code, we could now tell that the constants INT_MAX and
LONG_MAX come from different macro expansions in system headers, and
avoid warning in this specific case, but that would be better done in
a follow-up patch. Dodji, is that possible? how could it be done?

Bootstrapped and regression tested.

OK?

2012-05-05  Manuel López-Ibáñez  <m...@gcc.gnu.org>

        PR c/43772
c-family/
        * c-common.c (warn_logical_operator): Do not warn if either side
        is already true or false.
testsuite/
        * c-c++-common/pr43772.c: New.

Attachment: fix-pr43772.diff
Description: Binary data

Reply via email to