1! { dg-do run }
2Module m
3  Implicit None
4  Type, Public :: t1
5    Integer, Allocatable :: i(:)
6  End Type
7  Type, Public :: t2
8    Integer, Allocatable :: i(:)
9  End Type
10  Type, Public :: t3
11    Type (t2) :: t
12  End Type
13  Type, Public :: t4
14  End Type
15  Type, Public, Extends (t4) :: t5
16    Type (t1) :: t_c1
17  End Type
18  Type, Public, Extends (t4) :: t6
19    Type (t5) :: t_c2
20  End Type
21  Type, Public, Extends (t6) :: t7
22    Type (t3) :: t_c3
23  End Type
24End Module
25Program main
26  Use m
27  Implicit None
28  Interface
29    Subroutine s(t)
30      Use m
31      Class (t4), Allocatable, Intent (Out) :: t
32    End Subroutine
33  End Interface
34  Class (t4), Allocatable :: t
35  Call s(t)
36  Deallocate (t)
37End Program
38Subroutine s(t)
39  Use m
40  Class (t4), Allocatable, Intent (Out) :: t
41  Allocate (t7 :: t)
42End Subroutine
43