Merge from mainline
[official-gcc.git] / gcc / testsuite / gfortran.dg / used_dummy_types_5.f90
blobb8b15e009502ec4b9a34d8bde490488f7c01b330
1 ! { dg-do compile }
2 ! This checks that the fix for PR19362 has not broken gfortran
3 ! in respect of.references allowed by 4.4.2.
5 ! Contributed by Paul Thomas <pault@gcc.gnu.org>
6 !==============
7 module global
9 TYPE :: seq_type1
10 sequence
11 integer :: i
12 end type seq_type1
14 TYPE :: nonseq_type1
15 integer :: i = 44
16 end type nonseq_type1
17 type (nonseq_type1), save :: ns1
19 end module global
21 use global, only: seq_type2=>seq_type1, nonseq_type1, ns1
23 ! Host non-sequence types
24 type :: different_type
25 integer :: i
26 end type different_type
28 type :: same_type
29 sequence
30 integer :: i
31 end type same_type
33 type (seq_type2) :: t1
34 type (different_type) :: dt1
36 type (nonseq_type1) :: ns2
37 type (same_type) :: st1
38 real seq_type1
40 t1 = seq_type2 (42)
41 dt1 = different_type (43)
42 ns2 = ns1
43 seq_type1 =1.0e32
44 st1%i = 45
46 call foo (t1)
48 contains
50 subroutine foo (x)
52 use global, only: seq_type3=>seq_type1
54 TYPE :: seq_type1
55 sequence
56 integer :: i
57 end type seq_type1
59 type :: different_type
60 complex :: z
61 end type different_type
63 type :: same_type
64 sequence
65 integer :: i
66 end type same_type
67 ! Host association of renamed type.
68 type (seq_type2) :: x
69 ! Locally declared version of the same thing.
70 type (seq_type1) :: y
71 ! USE associated renamed type.
72 type (seq_type3) :: z
75 type (different_type) :: dt2
76 type (same_type) :: st2
78 dt2%z = (2.0,-1.0)
79 y = seq_type2 (46)
80 z = seq_type3 (47)
81 st2 = st1
82 print *, x, y, z, dt2, st2, ns2, ns1
83 end subroutine foo
84 END