OSDN Git Service

PR fortran/21104
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gfortran.dg / array_alloc_1.f90
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
15
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