This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
c/2511: -pedantic not warning about bitfield overflow
- To: gcc-gnats at gcc dot gnu dot org
- Subject: c/2511: -pedantic not warning about bitfield overflow
- From: Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>
- Date: 9 Apr 2001 01:47:02 -0000
- Reply-To: Dan Nicolaescu <dann at godzilla dot ics dot uci dot edu>
>Number: 2511
>Category: c
>Synopsis: -pedantic not warning about bitfield overflow
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Apr 08 18:56:00 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator: Dan Nicolaescu <dann@godzilla.ics.uci.edu>
>Release: gcc version 3.1 20010314 (experimental)
>Organization:
>Environment:
i386-pc-linux-gnu
>Description:
gcc -pedantic does not warn about bitfield overflow.
For example:
struct test
{
signed int a:16;
signed int b:8;
int pad:8;
};
struct test c = {32768, 256, 0};
signed short int d = 32768;
signed char e = 256;
compile with gcc -pedantic
and it will warn aboud d and e:
t.c:10: warning: overflow in implicit constant conversion
t.c:11: warning: overflow in implicit constant conversion
but nothing about the initialization of struct test c;
IMHO it should warn about those too.
>How-To-Repeat:
compile the example with gcc -pedantic and see that there are no
warnings generated for struc test c
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
but present in all releases