This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/37261] New: Spurious (?) "integer overflow in expression" warnings
- From: "roland at digitalvampire dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Aug 2008 23:45:19 -0000
- Subject: [Bug c/37261] New: Spurious (?) "integer overflow in expression" warnings
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
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