blob: 4c1c6efe6059de98de3a7be7c08f360d00594b21 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
! { dg-do run }
! { dg-options "-fdec-structure" }
!
! Test nested UNIONs.
!
subroutine aborts (s)
character(*), intent(in) :: s
print *, s
call abort()
end subroutine
! Nested unions
structure /s4/
union ! U0 ! rax
map
character(16) rx
end map
map
character(8) rh ! rah
union ! U1
map
character(8) rl ! ral
end map
map
character(8) ex ! eax
end map
map
character(4) eh ! eah
union ! U2
map
character(4) el ! eal
end map
map
character(4) x ! ax
end map
map
character(2) h ! ah
character(2) l ! al
end map
end union
end map
end union
end map
end union
end structure
record /s4/ r4
! Nested unions
r4.rx = 'AAAAAAAA.BBB.C.D'
if ( r4.rx .ne. 'AAAAAAAA.BBB.C.D' ) call aborts ("rax")
if ( r4.rh .ne. 'AAAAAAAA' ) call aborts ("rah")
if ( r4.rl .ne. '.BBB.C.D' ) call aborts ("ral")
if ( r4.ex .ne. '.BBB.C.D' ) call aborts ("eax")
if ( r4.eh .ne. '.BBB' ) call aborts ("eah")
if ( r4.el .ne. '.C.D' ) call aborts ("eal")
if ( r4.x .ne. '.C.D' ) call aborts ("ax")
if ( r4.h .ne. '.C' ) call aborts ("ah")
if ( r4.l .ne. '.D' ) call aborts ("al")
end
|