comparison gcc/testsuite/gfortran.dg/allocate_with_source_21.f03 @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
1 ! { dg-do compile }
2
3 ! Check fix for pr71936.
4 ! Contributed by Gerhard Steinmetz
5
6 program p
7 type t
8 end type
9
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
19
20 function f_a()
21 class(t), allocatable :: f_a(:)
22 end
23
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
30
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
37
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
44
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
52