OSDN Git Service

2010-09-05 Tobias Burnus <burnus@net-b.de>
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / allocatable_scalar_9.f90
1 ! { dg-do run }
2 !
3 ! PR 42647: Missed initialization/dealloc of allocatable scalar DT with allocatable component
4 !
5 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
6
7 module m                                                                        
8 type st                                                                         
9   integer , allocatable :: a1                                                   
10 end type st                                                                     
11 type at                                                                         
12   integer , allocatable :: a2(:)                                                
13 end type at                                                                     
14
15 type t1
16   type(st), allocatable :: b1
17 end type t1
18 type t2
19   type(st), allocatable :: b2(:)
20 end type t2
21 type t3
22   type(at), allocatable :: b3
23 end type t3
24 type t4
25   type(at), allocatable :: b4(:)
26 end type t4
27 end module m
28
29 use m
30 type(t1) :: na1, a1, aa1(:)
31 type(t2) :: na2, a2, aa2(:)
32 type(t3) :: na3, a3, aa3(:)
33 type(t4) :: na4, a4, aa4(:)
34 allocatable :: a1, a2, a3, a4, aa1, aa2, aa3,aa4
35
36 if(allocated(a1)) call abort()
37 if(allocated(a2)) call abort()
38 if(allocated(a3)) call abort()
39 if(allocated(a4)) call abort()
40 if(allocated(aa1)) call abort()
41 if(allocated(aa2)) call abort()
42 if(allocated(aa3)) call abort()
43 if(allocated(aa4)) call abort()
44
45 if(allocated(na1%b1)) call abort()
46 if(allocated(na2%b2)) call abort()
47 if(allocated(na3%b3)) call abort()
48 if(allocated(na4%b4)) call abort()
49 end
50
51 ! { dg-final { cleanup-modules "m" } }