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

--- Comment #3 from Martin Sebor <msebor at gmail dot com> 2011-06-10 17:44:47 
UTC ---
Here's another test case, one that does involve slicing and where a consistent
but differently phrased warning would, IMO, be useful. Perhaps something like:

warning: slicing high order bits in implicit constant conversion

cat << EOF | gcc -c -xc -
struct S {
    unsigned a:1;
    unsigned b:1;
};

void f (struct S *s, int i) {
    s->a = i & 0x10;   /* line 7: no warning */
    s->b = i & 0x80;   /* line 8: warning  */
}
EOF
<stdin>: In function ‘f’:
<stdin>:8:5: warning: overflow in implicit constant conversion [-Woverflow]

Reply via email to