[Bug c/37261] New: Spurious (?) "integer overflow in expression" warnings

roland at digitalvampire dot org gcc-bugzilla@gcc.gnu.org
Wed Aug 27 23:46:00 GMT 2008


With:

$ gcc --version
gcc (Debian 4.3.1-2) 4.3.1

running on x86-64, the code below produces seemingly spurious warnings about
integer overflow:

$ LANG=C gcc -c b.c
b.c: In function 'foo':
b.c:3: warning: integer overflow in expression
b.c:5: warning: integer overflow in expression

$ cat b.c
unsigned foo(int x)
{
        return ((x & 1) | 2) & 0x80000000;
        return ((x & 2) | 2) & 0x80000000;
        return ((x & 4) | 2) & 0x80000000;
}


-- 
           Summary: Spurious (?) "integer overflow in expression" warnings
           Product: gcc
           Version: 4.3.1
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: roland at digitalvampire dot org
 GCC build triplet: x86_64-linux-gnu
  GCC host triplet: x86_64-linux-gnu
GCC target triplet: x86_64-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37261



More information about the Gcc-bugs mailing list