Debian Codegraph @

gcc/testsuite/gfortran.dg/bind_c_procs_3.f90

raw
1 ! { dg-do run }
2 !
3 ! Test the fix for PR92123, in which 'dat' caused an error with the message
4 ! "Scalar variable 'dat' at ?? with POINTER or ALLOCATABLE in procedure Fsub
5 ! with BIND(C) is not yet supported."
6 !
7 ! Contributed by Vipul Parekh <[email protected]>
8 !
9 module m
10 use, intrinsic :: iso_c_binding, only : c_int
11 contains
12 subroutine Fsub( dat ) bind(C, name="Fsub")
13 !.. Argument list
14 integer(c_int), allocatable, intent(out) :: dat
15 dat = 42
16 return
17 end subroutine
18 end module m
19
20 use, intrinsic :: iso_c_binding, only : c_int
21 use m, only : Fsub
22 integer(c_int), allocatable :: x
23 call Fsub( x )
24 if (x .ne. 42) stop 1
25 end