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

Reply via email to