public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/12625] New: bitfields of size 8 missed by -Wparentheses
@ 2003-10-15 18:07 nomura at netapp dot com
  2004-07-20 15:15 ` [Bug c++/12625] bitfields which have sizes that are powers of " giovannibajo at libero dot it
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: nomura at netapp dot com @ 2003-10-15 18:07 UTC (permalink / raw)
  To: gcc-bugs

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]$


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2006-04-23 20:05 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <bug-12625-4304@http.gcc.gnu.org/bugzilla/>
2006-04-23 20:05 ` [Bug c++/12625] bitfields which have sizes that are powers of 8 missed by -Wparentheses pinskia at gcc dot gnu dot org
2003-10-15 18:07 [Bug c/12625] New: bitfields of size " nomura at netapp dot com
2004-07-20 15:15 ` [Bug c++/12625] bitfields which have sizes that are powers of " giovannibajo at libero dot it
2004-07-22  3:22 ` pinskia at gcc dot gnu dot org
2004-10-13 12:35 ` pinskia at gcc dot gnu dot org

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).