comparison gcc/testsuite/gfortran.dg/dec_union_3.f90 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children 84e7813d76e9
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ! { dg-do run }
2 ! { dg-options "-fdec-structure" }
3 !
4 ! Test UNIONs with initializations.
5 !
6
7 subroutine aborts (s)
8 character(*), intent(in) :: s
9 print *, s
10 call abort()
11 end subroutine
12
13 ! Initialization expressions
14 structure /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
25 end structure
26
27 record /s3/ r3
28
29 ! Initialized unions
30 if ( 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")
33 endif
34
35 end