This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
New gcc 4.0.0 warnings seem spurious
- From: Bruce Lilly <blilly at erols dot com>
- To: gcc at gcc dot gnu dot org
- Date: Tue, 26 Apr 2005 10:45:57 -0400
- Subject: New gcc 4.0.0 warnings seem spurious
- Organization: Bruce Lilly
- Reply-to: Bruce Lilly <blilly at erols dot com>
Demonstration code:
--------------------------
#define AAA 0x1U
#define BBB 0x2U
struct foo {
unsigned int bar:8;
};
struct foo foos[] = {
{ ~(AAA) },
{ ~(BBB) },
{ ~(AAA|BBB) },
{ ~(AAA&BBB) }
};
--------------------------
compiling with gcc 3.x produced no warnings, as expected (no problems as
all values fit easily within the defined structure's bit field).
gcc 4.0.0 produces:
gcctest.c:9: warning: large integer implicitly truncated to unsigned type
gcctest.c:10: warning: large integer implicitly truncated to unsigned type
gcctest.c:11: warning: large integer implicitly truncated to unsigned type
gcctest.c:12: warning: large integer implicitly truncated to unsigned type