1! { dg-do run }
2! { dg-options "-fdec-structure" }
3!
4! Test UNIONs with initializations.
5!
6
7subroutine aborts (s)
8  character(*), intent(in) :: s
9  print *, s
10  STOP 1
11end subroutine
12
13! Initialization expressions
14structure /s3/
15  integer(4) :: i = 8
16  union ! U7
17    map
18      integer(4) :: x = 1600
19      integer(4) :: y = 1800
20    end map
21    map
22      integer(2) a, b, c
23    end map
24  end union
25end structure
26
27record /s3/ r3
28
29! Initialized unions
30if ( r3.x .ne. 1600 .or. r3.y .ne. 1800) then
31  r3.x = r3.y ! If r3 isn't used the initializations are optimized out
32  call aborts ("union initialization")
33endif
34
35end
36