From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9176 invoked by alias); 20 Jul 2004 14:59:25 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 9165 invoked by alias); 20 Jul 2004 14:59:24 -0000 Date: Tue, 20 Jul 2004 14:59:00 -0000 Message-ID: <20040720145924.9164.qmail@sourceware.org> From: "jsm at polyomino dot org dot uk" To: gcc-bugs@gcc.gnu.org In-Reply-To: <20031015180735.12625.nomura@netapp.com> References: <20031015180735.12625.nomura@netapp.com> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug c/12625] bitfields which have sizes that are powers of 8 missed by -Wparentheses X-Bugzilla-Reason: CC X-SW-Source: 2004-07/txt/msg02442.txt.bz2 List-Id: ------- Additional Comments From jsm at polyomino dot org dot uk 2004-07-20 14:59 ------- Subject: Re: bitfields which have sizes that are powers of 8 missed by -Wparentheses On Tue, 20 Jul 2004, pinskia at gcc dot gnu dot org wrote: > Fixed for 3.5.0 by the bitfield patch for C. I've committed the following testcase for this bug as none was included with the bit-field patch. Note however that the bug still exists for C++. Index: ChangeLog =================================================================== RCS file: /cvs/gcc/gcc/gcc/testsuite/ChangeLog,v retrieving revision 1.4022 diff -u -r1.4022 ChangeLog --- ChangeLog 20 Jul 2004 09:57:09 -0000 1.4022 +++ ChangeLog 20 Jul 2004 14:57:27 -0000 @@ -1,3 +1,7 @@ +2004-07-20 Joseph S. Myers + + * gcc.dg/pr12625-1.c: New test. + 2004-07-20 Steven Bosscher * testsuite/gcc.dg/switch-warn-1.c: New test. Index: gcc.dg/pr12625-1.c =================================================================== RCS file: gcc.dg/pr12625-1.c diff -N gcc.dg/pr12625-1.c --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ gcc.dg/pr12625-1.c 20 Jul 2004 14:57:27 -0000 @@ -0,0 +1,13 @@ +/* Warning for assignment used as truth-value should apply for + bit-fields. */ +/* Origin: bug 12625 from nomura at netapp.com */ +/* { dg-do compile } */ +/* { dg-options "-Wparentheses" } */ + +static struct { int i:8; } s; + +void +foo () +{ + if (s.i = 0) ; /* { dg-warning "parentheses" "warning for bit-field" } */ +} -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12625