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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
! { dg-do compile }
! This checks that the fix for PR19362 has not broken gfortran
! in respect of.references allowed by 4.4.2.
!
! Contributed by Paul Thomas <pault@gcc.gnu.org>
!==============
module global
TYPE :: seq_type1
sequence
integer :: i
end type seq_type1
TYPE :: nonseq_type1
integer :: i = 44
end type nonseq_type1
type (nonseq_type1), save :: ns1
end module global
use global, only: seq_type2=>seq_type1, nonseq_type1, ns1
! Host non-sequence types
type :: different_type
integer :: i
end type different_type
type :: same_type
sequence
integer :: i
end type same_type
type (seq_type2) :: t1
type (different_type) :: dt1
type (nonseq_type1) :: ns2
type (same_type) :: st1
real seq_type1
t1 = seq_type2 (42)
dt1 = different_type (43)
ns2 = ns1
seq_type1 =1.0e32
st1%i = 45
call foo (t1)
contains
subroutine foo (x)
use global, only: seq_type3=>seq_type1
TYPE :: seq_type1
sequence
integer :: i
end type seq_type1
type :: different_type
complex :: z
end type different_type
type :: same_type
sequence
integer :: i
end type same_type
! Host association of renamed type.
type (seq_type2) :: x
! Locally declared version of the same thing.
type (seq_type1) :: y
! USE associated renamed type.
type (seq_type3) :: z
type (different_type) :: dt2
type (same_type) :: st2
dt2%z = (2.0,-1.0)
y = seq_type2 (46)
z = seq_type3 (47)
st2 = st1
print *, x, y, z, dt2, st2, ns2, ns1
end subroutine foo
END
! { dg-final { cleanup-modules "global" } }
|