c++/8209: Failure to detect negative bit-field size (!)
wwieser@gmx.de
wwieser@gmx.de
Sun Oct 13 02:06:00 GMT 2002
>Number: 8209
>Category: c++
>Synopsis: Failure to detect negative bit-field size (!)
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: accepts-illegal
>Submitter-Id: net
>Arrival-Date: Sun Oct 13 02:06:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: wwieser@gmx.de
>Release: 3.2.1 20021007 (prerelease) and many more
>Organization:
>Environment:
linux-elf
>Description:
The bug was verified to be still present in yesterday's
CVS (Oct 12):
If you compile the following code:
struct A
{
int : (-1);
};
you get the (correct) _error_
negative width in bit-field `A::<anonymous>'
Now, if you compile
struct A
{
int : (sizeof(int)-5);
};
then you just get the _warning_
warning: width of `A::<anonymous>' exceeds its type
which is incorrect.
As a result, sizeof(A) turns out to be 536870912
(500Mb).
>How-To-Repeat:
Just compile the four-liner above.
>Fix:
Should be fairly trivial, but I don't know.
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gcc-bugs
mailing list