gcc/testsuite/gfortran.dg/ptr-func-4.f90
raw| 1 | ! { dg-do run } |
| 2 | ! { dg-options "-O2 -std=f2008" } |
| 3 | ! PR fortran/100218 - target of pointer from evaluation of function-reference |
| 4 | |
| 5 | program p |
| 6 | implicit none |
| 7 | integer, target :: z = 0 |
| 8 | call g (f ()) |
| 9 | if (z /= 1) stop 1 |
| 10 | contains |
| 11 | function f () result (r) |
| 12 | integer, pointer :: r |
| 13 | r => z |
| 14 | end function f |
| 15 | subroutine g (x) |
| 16 | integer, intent(out) :: x |
| 17 | x = 1 |
| 18 | end subroutine g |
| 19 | end program p |