This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c/81783] New: -Wtautological-compare could do better


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)
            ~~~~~~~~~~~^~~~~

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]