summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/cxxbitfields.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/c-c++-common/cxxbitfields.c')
-rw-r--r--gcc/testsuite/c-c++-common/cxxbitfields.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/cxxbitfields.c b/gcc/testsuite/c-c++-common/cxxbitfields.c
new file mode 100644
index 00000000000..43c840b15eb
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/cxxbitfields.c
@@ -0,0 +1,18 @@
+/* { dg-do compile { target i?86-*-* x86_64-*-* } } */
+/* { dg-options "-O2 --param allow-store-data-races=0" } */
+
+/* Test that we don't store past VAR.A. */
+
+struct S
+{
+ volatile unsigned int a : 4;
+ unsigned char b;
+ unsigned int c : 6;
+} var;
+
+void set_a()
+{
+ var.a = 12;
+}
+
+/* { dg-final { scan-assembler-not "movl.*, var" } } */