Debian Codegraph @

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

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