summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/union-4.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/testsuite/gcc.dg/union-4.c')
-rw-r--r--gcc/testsuite/gcc.dg/union-4.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/union-4.c b/gcc/testsuite/gcc.dg/union-4.c
new file mode 100644
index 000000000..df9f36da0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/union-4.c
@@ -0,0 +1,23 @@
+/* { dg-do compile } */
+/* { dg-options "-O -fdump-rtl-cse1" } */
+
+extern void abort(void);
+
+typedef unsigned int uint32;
+typedef unsigned long long uint64;
+
+typedef union {
+ uint32 i32;
+ uint64 i64;
+} u64;
+
+void foo(void)
+{
+ u64 data;
+ data.i64 = 1;
+ if (data.i32 != 1)
+ abort ();
+}
+
+/* { dg-final { scan-rtl-dump-not "abort" "cse1" { target i?86-*-* } } } */
+/* { dg-final { cleanup-rtl-dump "cse1" } } */