re PR middle-end/42898 (volatile structures and compound literal initializers)
authorEric Botcazou <ebotcazou@adacore.com>
Sun, 31 Jan 2010 20:00:54 +0000 (20:00 +0000)
committerEric Botcazou <ebotcazou@gcc.gnu.org>
Sun, 31 Jan 2010 20:00:54 +0000 (20:00 +0000)
PR middle-end/42898
* gcc.dg/torture/pr42898-2.c: New test.

From-SVN: r156414

gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/torture/pr42898-2.c [new file with mode: 0644]

index 2373079..482f196 100644 (file)
@@ -1,3 +1,8 @@
+2010-01-31  Eric Botcazou  <ebotcazou@adacore.com>
+
+       PR middle-end/42898
+       * gcc.dg/torture/pr42898-2.c: New test.
+
 2010-01-31  Richard Guenther  <rguenther@suse.de>
 
        PR middle-end/42898
diff --git a/gcc/testsuite/gcc.dg/torture/pr42898-2.c b/gcc/testsuite/gcc.dg/torture/pr42898-2.c
new file mode 100644 (file)
index 0000000..f90a85e
--- /dev/null
@@ -0,0 +1,25 @@
+/* { dg-do compile } */
+/* { dg-options "-fdump-tree-optimized" } */
+
+struct hardware {
+  int parm1:8;
+  int :4;
+  int parm2:4;
+  int parm3:15;
+  int parm4:1;
+};
+
+const struct hardware h = {
+  .parm1=42,
+  .parm2=13,
+  .parm3=11850,
+  .parm4=1,
+};
+
+void f1(volatile struct hardware *ptr)
+{
+  *ptr = h;
+}
+
+/* { dg-final { scan-tree-dump-times "\\*ptr" 1 "optimized" } } */
+/* { dg-final { cleanup-tree-dump "optimized" } } */