summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/ret_pointer_1.f90
blob: 765f20a2f18ef4518c605e333e0064516cfc02e4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
! { dg-do run }
! Test functions returning array pointers
program ret_pointer_1
  integer, pointer, dimension(:) :: a
  integer, target, dimension(2) :: b
  integer, pointer, dimension (:) :: p

  a => NULL()
  a => foo()
  p => b
  if (.not. associated (a, p)) call abort
contains
subroutine bar(p)
  integer, pointer, dimension(:) :: p
end subroutine
function foo() result(r)
  integer, pointer, dimension(:) :: r

  r => b
end function
end program