OSDN Git Service

PR debug/43329
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / used_dummy_types_5.f90
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.
4 !
5 ! Contributed by Paul Thomas  <pault@gcc.gnu.org>
6 !==============
7 module global
8
9   TYPE :: seq_type1
10     sequence
11     integer :: i
12   end type seq_type1
13
14   TYPE :: nonseq_type1
15     integer :: i = 44
16   end type nonseq_type1
17   type (nonseq_type1), save :: ns1
18
19 end module global
20
21   use global, only: seq_type2=>seq_type1, nonseq_type1, ns1
22
23 ! Host non-sequence types
24   type :: different_type
25     integer :: i
26   end type different_type
27
28   type :: same_type
29     sequence
30     integer :: i
31   end type same_type
32
33   type (seq_type2)  :: t1
34   type (different_type)  :: dt1
35
36   type (nonseq_type1) :: ns2
37   type (same_type)  :: st1
38   real seq_type1
39
40   t1 = seq_type2 (42)
41   dt1 = different_type (43)
42   ns2 = ns1
43   seq_type1 =1.0e32
44   st1%i = 45
45
46   call foo (t1)
47
48 contains
49
50   subroutine foo (x)
51
52     use global, only: seq_type3=>seq_type1
53
54     TYPE :: seq_type1
55       sequence
56       integer :: i
57     end type seq_type1
58
59     type :: different_type
60       complex :: z
61     end type different_type
62
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
73
74
75     type (different_type)  :: dt2
76     type (same_type)  :: st2
77
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
85
86 ! { dg-final { cleanup-modules "global" } }