3 ! Check that allocate with source for arrays without array-spec
6 ! Contributed by Tobias Burnus <burnus@gcc.gnu.org>
7 ! Antony Lewis <antony@cosmologist.info>
8 ! Andre Vehreschild <vehre@gcc.gnu.org>
11 program allocate_with_source_6
14 class(*), allocatable :: X(:,:)
20 type(t), allocatable :: a(:), b, c(:)
21 integer :: num_params_used = 6
22 integer, allocatable :: m(:)
25 allocate(a(5), source=b)
28 allocate(m, source=[(I, I=1, num_params_used)])
29 if (any(m /= [(I, I=1, num_params_used)])) call abort()
34 subroutine testArrays()
36 class(*), allocatable :: v(:)
41 real, allocatable :: v(:)
44 allocate(Y%X, source=arr)
45 select type (R => Y%X)
47 if (any(reshape(R, [15]) /= [5,5,5,5,5, 5,5,5,5,5, 5,5,5,5,5])) &
54 allocate(Y%X, source=arr(2:3,3:4))
55 select type (R => Y%X)
57 if (any(reshape(R, [4]) /= [5,5,5,5])) &
64 allocate(o%v, source=arr(2,3:4))
65 select type (R => o%v)
67 if (any(R /= [5,5])) &
74 allocate(v, source=arr(2,1:5))
75 if (any(v /= [5,5,5,5,5])) call abort()
77 end subroutine testArrays