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

            Bug ID: 82437
           Summary: false-positive -Wtautological-compare warning with
                    -std=gnu89
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c
          Assignee: unassigned at gcc dot gnu.org
          Reporter: arnd at linaro dot org
  Target Milestone: ---

I found several instances of a new warning in the linux kernel, building with
"gcc-8.0.0 -std=gnu89", reduced a test case to this:

$ arm-linux-gnueabi-gcc-8.0.0  -c vfpmodule.c   -std=c89 -Wall
int f(unsigned int x)
{
        if ((x & ((1 << 31) | (1 << 28))) != ((1 << 31) | (1 << 28)))
                return 0;
        return 1;
}

vfpmodule.c: In function 'f':
vfpmodule.c:3:36: warning: bitwise comparison always evaluates to true
[-Wtautological-compare]
  if ((x & ((1 << 31) | (1 << 28))) != ((1 << 31) | (1 << 28)))

The object code that gets produces looks correct, so I assume this is simply a
warning problem, possibly related to pr81783 that introduced new warnings.

Reply via email to