This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/41138] Inconsistent (incorrect?) "overflow in implicit constant conversion" warning
- From: "msebor at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 10 Jun 2011 17:45:16 +0000
- Subject: [Bug c/41138] Inconsistent (incorrect?) "overflow in implicit constant conversion" warning
- Auto-submitted: auto-generated
- References: <bug-41138-4@http.gcc.gnu.org/bugzilla/>
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]