* tree-loop-distribution.c (struct partition): New field recording
[official-gcc.git] / gcc / testsuite / gfortran.dg / allocate_with_source_21.f03
blobfbf31593157724b9c1c0da66864a40a233f3bd3d
1 ! { dg-do compile }
3 ! Check fix for pr71936.
4 ! Contributed by Gerhard Steinmetz
6 program p
7   type t
8   end type
10   call test2()
11   call test4()
12   call test1()
13   call test3()
14 contains
15   function f_p()
16     class(t), pointer :: f_p(:)
17     nullify(f_p)
18   end
20   function f_a()
21     class(t), allocatable :: f_a(:)
22   end
24   subroutine test1()
25     class(t), allocatable :: x(:)
26     allocate (x, mold=f_a())
27     deallocate (x)
28     allocate (x, source=f_a())
29   end subroutine
31   subroutine test2()
32     class(t), pointer :: x(:)
33     allocate (x, mold=f_p())
34     deallocate (x)
35     allocate (x, source=f_p())
36   end
38   subroutine test3()
39     class(t), pointer :: x(:)
40     allocate (x, mold=f_a())
41     deallocate (x)
42     allocate (x, source=f_a())
43   end
45   subroutine test4()
46     class(t), allocatable :: x(:)
47     allocate (x, mold=f_p())
48     deallocate (x)
49     allocate (x, source=f_p())
50   end subroutine
51 end