Debian Codegraph @

gcc/testsuite/gfortran.dg/c-interop/removed-restrictions-2.f90

raw
1 ! { dg-do compile }
2 !
3 ! TS 29113
4 ! 8.1 Removed restrictions on ISO_C_BINDING module procedures
5 !
6 ! The function C_F_PROCPOINTER from the intrinsic module ISO_C_BINDING
7 ! has the restriction in ISO/IEC 1539-1:2010 that CPTR and FPTR shall
8 ! not be the C address and interface of a noninteroperable Fortran
9 ! procedure.
10 !
11 ! [...]
12 !
13 ! These restrictions are removed.
14
15 module m
16 use ISO_C_BINDING
17 implicit none
18
19 ! Declare a non-interoperable Fortran procedure interface.
20 abstract interface
21 function foo (x, y)
22 integer :: foo
23 integer, intent (in) :: x, y
24 end function
25 end interface
26
27 contains
28
29 subroutine test (cptr, fptr)
30 type(C_FUNPTR), intent(in) :: cptr
31 procedure (foo), pointer, intent(out) :: fptr
32
33 call c_f_procpointer (cptr, fptr)
34 end subroutine
35 end module