diff options
Diffstat (limited to 'gcc/testsuite/gfortran.dg/proc_ptr_20.f90')
-rw-r--r-- | gcc/testsuite/gfortran.dg/proc_ptr_20.f90 | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/proc_ptr_20.f90 b/gcc/testsuite/gfortran.dg/proc_ptr_20.f90 new file mode 100644 index 00000000000..79c9ba8f1ec --- /dev/null +++ b/gcc/testsuite/gfortran.dg/proc_ptr_20.f90 @@ -0,0 +1,42 @@ +! { dg-do run } +! +! PR 40450: [F03] procedure pointer as actual argument +! +! Contributed by John McFarland <john.mcfarland@swri.org> + +MODULE m + ABSTRACT INTERFACE + SUBROUTINE sub() + END SUBROUTINE sub + END INTERFACE + +CONTAINS + + SUBROUTINE passf(f2) + PROCEDURE(sub), POINTER:: f2 + CALL callf(f2) + END SUBROUTINE passf + + SUBROUTINE callf(f3) + PROCEDURE(sub), POINTER :: f3 + PRINT*, 'calling f' + CALL f3() + END SUBROUTINE callf +END MODULE m + + +PROGRAM prog + USE m + PROCEDURE(sub), POINTER :: f1 + f1 => s + CALL passf(f1) + +CONTAINS + + SUBROUTINE s + PRINT*, 'sub' + END SUBROUTINE s +END PROGRAM prog + +! { dg-final { cleanup-modules "m" } } + |