aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/dec_union_3.f90
diff options
context:
space:
mode:
authorAndrew Macleod <amacleod@redhat.com>2016-05-10 03:30:56 +0000
committerAndrew Macleod <amacleod@redhat.com>2016-05-10 03:30:56 +0000
commit357ceb7fe26970b6c6e12f0bb2ceecab6c6a2454 (patch)
tree48eb1f57289f4e995f069f38213ad5c8a16f0347 /gcc/testsuite/gfortran.dg/dec_union_3.f90
parent5ed230ef2005822d6402118e58a311db2a9cb0c7 (diff)
parent8a50780e586342528692744150d08651fb07fb43 (diff)
update to 2016-05-09ttype-2016-05-03
git-svn-id: https://gcc.gnu.org/svn/gcc/branches/ttype-2016-05-03@236057 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gfortran.dg/dec_union_3.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/dec_union_3.f9035
1 files changed, 35 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/dec_union_3.f90 b/gcc/testsuite/gfortran.dg/dec_union_3.f90
new file mode 100644
index 00000000000..ce5ae797859
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/dec_union_3.f90
@@ -0,0 +1,35 @@
+! { dg-do run }
+! { dg-options "-fdec-structure" }
+!
+! Test UNIONs with initializations.
+!
+
+subroutine aborts (s)
+ character(*), intent(in) :: s
+ print *, s
+ call abort()
+end subroutine
+
+! Initialization expressions
+structure /s3/
+ integer(4) :: i = 8
+ union ! U7
+ map
+ integer(4) :: x = 1600
+ integer(4) :: y = 1800
+ end map
+ map
+ integer(2) a, b, c
+ end map
+ end union
+end structure
+
+record /s3/ r3
+
+! Initialized unions
+if ( r3.x .ne. 1600 .or. r3.y .ne. 1800) then
+ r3.x = r3.y ! If r3 isn't used the initializations are optimized out
+ call aborts ("union initialization")
+endif
+
+end