This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/14294] New: bogus warning
- From: "nathan at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 25 Feb 2004 17:26:42 -0000
- Subject: [Bug c/14294] New: bogus warning
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
struct a {unsigned b : 2;};
int foo (struct a *p) {return 2u < p->b + 1;}
int bar (struct a *p) {return 2u < (unsigned)p->b + 1;}
gcc -W -Wall gives
bitfield.c:2: warning: comparison between signed and unsigned
bitfield.c:3: warning: comparison between signed and unsigned
1) is it correct to promote an unsigned bitfield smaller than an int to
signed int? (I think so, but am not 100% sure)
2) (unsigned)p->b + 1, should have unsigned type, hence the 2nd warning is spurious
--
Summary: bogus warning
Product: gcc
Version: 3.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: nathan at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=14294