[Bug c/37502] New: no warning for always-false/true conditions due to too small bitfields
j at uriah dot heep dot sax dot de
gcc-bugzilla@gcc.gnu.org
Fri Sep 12 20:02:00 GMT 2008
Given the following code:
volatile struct {
unsigned char a: 1;
} bits;
unsigned char
getfoo(void)
{
while (bits.a < 3)
/* wait */;
return 42;
}
GCC does not emit a warning with -Wall -Wextra yet happily generates an
infinite loop since the while condition is always true due to the
limited size of the bitfield. I expected to get a warning similar to
those when using a too small integer type.
--
Summary: no warning for always-false/true conditions due to too
small bitfields
Product: gcc
Version: 4.3.1
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: j at uriah dot heep dot sax dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37502
More information about the Gcc-bugs
mailing list