https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81783

            Bug ID: 81783
           Summary: -Wtautological-compare could do better
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: sirl at gcc dot gnu.org
  Target Milestone: ---

This example code doesn't warn with -Wtautological-compare:

int f(int a)
{
        if ((a & 0x10) == 10)
                return 1;
        return 0;
}

clang warns like this:
Wtautological-compare-1.c:5:17: warning: bitwise comparison always evaluates to
false [-Wtautological-compare]
        if ((a & 0x10) == 10)
            ~~~~~~~~~~~^~~~~

Reply via email to