view gcc/testsuite/gfortran.dg/proc_ptr_20.f90 @ 127:4c56639505ff

fix function.c and add CbC-example Makefile
author mir3636
date Wed, 11 Apr 2018 18:46:58 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { 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