summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/torture/pr42898-2.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/torture/pr42898-2.c')
-rw-r--r--gcc/testsuite/gcc.dg/torture/pr42898-2.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/torture/pr42898-2.c b/gcc/testsuite/gcc.dg/torture/pr42898-2.c
new file mode 100644
index 000000000..f90a85ea6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/torture/pr42898-2.c
@@ -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" } } */