2017-02-20 Paul Thomas <pault@gcc.gnu.org>
[official-gcc.git] / gcc / testsuite / gfortran.dg / array_alloc_1.f90
blob17be757a918b5fbfe007dfa82380d6ad438040aa
1 ! PR 21104. Make sure that either f() or its caller will allocate
2 ! the array data. We've decided to make the caller allocate it.
3 ! { dg-do run }
4 program main
5 implicit none
6 call test (f ())
7 contains
8 subroutine test (x)
9 integer, dimension (10) :: x
10 integer :: i
11 do i = 1, 10
12 if (x (i) .ne. i * 100) call abort
13 end do
14 end subroutine test
16 function f ()
17 integer, dimension (10) :: f
18 integer :: i
19 forall (i = 1:10) f (i) = i * 100
20 end function f
21 end program main