This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

c/2511: -pedantic not warning about bitfield overflow



>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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]