This is the mail archive of the gcc-patches@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]

Re: [Bug c/12625] bitfields which have sizes that are powers of 8missed 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  <jsm@polyomino.org.uk>
+
+	* gcc.dg/pr12625-1.c: New test.
+
 2004-07-20  Steven Bosscher  <stevenb@suse.de>
 
 	* 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" } */
+}

-- 
Joseph S. Myers               http://www.srcf.ucam.org/~jsm28/gcc/
    jsm@polyomino.org.uk (personal mail)
    jsm28@gcc.gnu.org (Bugzilla assignments and CCs)


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