2011-05-23 Tom de Vries <tom@codesourcery.com>
[official-gcc.git] / gcc / testsuite / gfortran.dg / ret_pointer_1.f90
blob765f20a2f18ef4518c605e333e0064516cfc02e4
1 ! { dg-do run }
2 ! Test functions returning array pointers
3 program ret_pointer_1
4 integer, pointer, dimension(:) :: a
5 integer, target, dimension(2) :: b
6 integer, pointer, dimension (:) :: p
8 a => NULL()
9 a => foo()
10 p => b
11 if (.not. associated (a, p)) call abort
12 contains
13 subroutine bar(p)
14 integer, pointer, dimension(:) :: p
15 end subroutine
16 function foo() result(r)
17 integer, pointer, dimension(:) :: r
19 r => b
20 end function
21 end program