OSDN Git Service

2011-01-29 Jerry DeLisle <jvdelisle@gcc.gnu.org>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / allocate_with_typespec_1.f90
1 ! { dg-do compile }
2 !
3 ! Allocation of arrays with a type-spec specification with implicit none.
4 !
5 subroutine implicit_none_test1
6
7    implicit none
8
9    real, allocatable :: x(:)
10    real(4), allocatable :: x4(:)
11    real(8), allocatable :: x8(:)
12    double precision, allocatable :: d1(:)
13    doubleprecision, allocatable :: d2(:)
14    character, allocatable :: c1(:)
15    character(len=4), allocatable :: c2(:)
16
17    type a
18       integer mytype
19    end type a
20
21    type(a), allocatable :: b(:)
22
23    allocate(real :: x(1))
24    allocate(real(4) :: x4(1))
25    allocate(real(8) :: x8(1))
26    allocate(double precision :: d1(1))
27    allocate(doubleprecision :: d2(1))
28    allocate(character :: c1(1))
29    allocate(character(len=4) :: c2(1))
30    allocate(a :: b(1))
31
32 end subroutine implicit_none_test1
33 !
34 ! Allocation of a scalar with a type-spec specification with implicit none
35 !
36 subroutine implicit_none_test2
37
38    implicit none
39
40    real, allocatable :: x
41    real(4), allocatable :: x4
42    real(8), allocatable :: x8
43    double precision, allocatable :: d1
44    doubleprecision, allocatable :: d2
45    character, allocatable :: c1
46    character(len=4), allocatable :: c2
47
48    type a
49       integer mytype
50    end type a
51
52    type(a), allocatable :: b
53
54    allocate(real :: x)
55    allocate(real(4) :: x4)
56    allocate(real(8) :: x8)
57    allocate(double precision :: d1)
58    allocate(doubleprecision :: d2)
59    allocate(character :: c1)
60    allocate(character(len=4) :: c2)
61    allocate(a :: b)
62
63 end subroutine implicit_none_test2
64 !
65 ! Allocation of arrays with a type-spec specification with implicit none.
66 !
67 subroutine implicit_test3
68
69    real, allocatable :: x(:)
70    real(4), allocatable :: x4(:)
71    real(8), allocatable :: x8(:)
72    double precision, allocatable :: d1(:)
73    doubleprecision, allocatable :: d2(:)
74    character, allocatable :: c1(:)
75    character(len=4), allocatable :: c2(:)
76
77    type a
78       integer mytype
79    end type a
80
81    type(a), allocatable :: b(:)
82
83    allocate(real :: x(1))
84    allocate(real(4) :: x4(1))
85    allocate(real(8) :: x8(1))
86    allocate(double precision :: d1(1))
87    allocate(doubleprecision :: d2(1))
88    allocate(character :: c1(1))
89    allocate(character(len=4) :: c2(1))
90    allocate(a :: b(1))
91
92 end subroutine implicit_test3
93 !
94 ! Allocation of a scalar with a type-spec specification without implicit none
95 !
96 subroutine implicit_test4
97
98    real, allocatable :: x
99    real(4), allocatable :: x4
100    real(8), allocatable :: x8
101    double precision, allocatable :: d1
102    doubleprecision, allocatable :: d2
103    character, allocatable :: c1
104    character(len=4), allocatable :: c2
105
106    type a
107       integer mytype
108    end type a
109
110    type(a), allocatable :: b
111
112    allocate(real :: x)
113    allocate(real(4) :: x4)
114    allocate(real(8) :: x8)
115    allocate(double precision :: d1)
116    allocate(doubleprecision :: d2)
117    allocate(character :: c1)
118    allocate(character(len=4) :: c2)
119    allocate(a :: b)
120
121 end subroutine implicit_test4