This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Continue strict-volatile-bitfields fixes
- From: "Joey Ye" <joey dot ye at arm dot com>
- To: <bernds_cb1 at t-online dot de>, <dj at redhat dot com>, <mark at codesourcery dot com>
- Cc: <gcc at gcc dot gnu dot org>
- Date: Fri, 11 Nov 2011 23:30:28 +0800
- Subject: Continue strict-volatile-bitfields fixes
-fstrict-volatile-bitfields doesn't work incorrectly in some cases
when storing into a volatile bit-field.
Bernd provided a fix here about 1 year ago:
http://gcc.gnu.org/ml/gcc-patches/2010-12/msg00217.html.
But it is pending to trunk. Here are my humble opinions and hopefully
we can revive it:
1. The fix could have helped lots of those who use volatile bit-fields,
but has been blocked for 1 year by ABI version 1, a feature that I believe
no one nowadays is using with latest gcc. Either error out ABI version 1
for some target, or just revising the failed ABI test case is OK for me.
2. This bug impacts all targets, especially target with
strict-volatile-bitfields default enabled like ARM. The test case Bernd
provided can be revised to a target independent case.
+++ gcc/testsuite/gcc.dg/volatile-bitfields-4.c (revision 0)
@@ -0,0 +1,15 @@
+/* { dg-do run } */
+/* { dg-options "-fstrict-volatile-bitfields" } */
+
+extern void abort(void);
+struct thing {
+ volatile unsigned short a: 8;
+ volatile unsigned short b: 8;
+} t = {1,2};
+
+int main()
+{
+ t.a = 3;
+ if (t.a !=3 || t.b !=2) abort();
+ return 0;
+}