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]
Other format: [Raw text]

[Bug c/12625] New: bitfields of size 8 missed by -Wparentheses


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12625

           Summary: bitfields of size 8 missed by -Wparentheses
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: nomura at netapp dot com
                CC: gcc-bugs at gcc dot gnu dot org

This testcase:

[siml4]$ cat bug.c

struct { int i:8; } s; 

void foo()
{
        if (s.i = 0) ;
}

is compiled as follows:

[siml4]$ tools/i686-gcc -c -Wparentheses bug.c

and we expect that -Wparentheses should warn as follows:

bug.c: In function `foo':
bug.c:5: warning: suggest parentheses around assignment used as truth value

but no warning is issued.  This thwarts our use of -Wparentheses to
clean up our code.  Moreover it's inconsistent in that any other 
declaration of field "i" seems to result in a warning.  
Bitfield of size 7 or 9 gives a warning.
short instead of int gives a warning.  
Non bitfields give a warning.

Seen in 3.3.1 on Linux (see below), but also in the 3.2 compiler packaged
with Redhat Linux 8 -- so it's probably not too sensitive to version.

[siml4]$ tools/i686-gcc -v
Reading specs from
/usr/local/build/compilers/gcc-3.3.1_277537/lib/gcc-lib/i686-pc-linux-gnu/3.3.1/specs
Configured with: ../gcc-3.3.1/configure
--enable-languages=c,c++,f77,java,objc,treelang
--prefix=/usr/local/build/compilers/gcc-3.3.1_277537
Thread model: posix
gcc version 3.3.1 ($Change: 277537 $)
[siml4]$


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