public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "nomura at netapp dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c/12625] New: bitfields of size 8 missed by -Wparentheses Date: Wed, 15 Oct 2003 18:07:00 -0000 [thread overview] Message-ID: <20031015180735.12625.nomura@netapp.com> (raw) 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]$
next reply other threads:[~2003-10-15 18:07 UTC|newest] Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top 2003-10-15 18:07 nomura at netapp dot com [this message] 2003-10-15 18:09 ` [Bug c/12625] " nomura at netapp dot com 2003-10-15 18:16 ` nomura at netapp dot com 2003-10-15 18:17 ` [Bug c/12625] bitfields which have sizes that are powers of " pinskia at gcc dot gnu dot org 2004-01-19 19:29 ` pinskia at gcc dot gnu dot org 2004-07-20 14:51 ` pinskia at gcc dot gnu dot org 2004-07-20 14:59 ` jsm at polyomino dot org dot uk 2004-07-20 15:15 ` [Bug c++/12625] " 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20031015180735.12625.nomura@netapp.com \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).