aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/ptr-func-4.f90
blob: 62b18f6a93506702250c91cc89a3b4f5dc689a2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
! { dg-do run }
! { dg-options "-O2 -std=f2008" }
! PR fortran/100218 - target of pointer from evaluation of function-reference

program p
  implicit none
  integer, target :: z = 0
  call g (f ())
  if (z /= 1) stop 1
contains
  function f () result (r)
    integer, pointer :: r
    r => z
  end function f
  subroutine g (x)
    integer, intent(out) :: x
    x = 1
  end subroutine g
end program p