| 1 |
! { dg-do run } |
| 2 |
! { dg-additional-sources bind_c_usage_10_c.c } |
| 3 |
! |
| 4 |
! PR fortran/34079 |
| 5 |
! |
| 6 |
! Check BIND(C) for ENTRY |
| 7 |
! |
| 8 |
module mod |
| 9 |
use iso_c_binding |
| 10 |
implicit none |
| 11 |
contains |
| 12 |
subroutine sub1(j) bind(c, name="mySub1") |
| 13 |
integer(c_int) :: j |
| 14 |
real(c_float) :: x |
| 15 |
j = 5 |
| 16 |
return |
| 17 |
entry sub1ent(x) |
| 18 |
x = 55.0 |
| 19 |
end subroutine sub1 |
| 20 |
subroutine sub2(j) |
| 21 |
integer(c_int) :: j |
| 22 |
real(c_float) :: x |
| 23 |
j = 6 |
| 24 |
return |
| 25 |
entry sub2ent(x) bind(c, name="mySubEnt2") |
| 26 |
x = 66.0 |
| 27 |
end subroutine sub2 |
| 28 |
subroutine sub3(j) bind(c, name="mySub3") |
| 29 |
integer(c_int) :: j |
| 30 |
real(c_float) :: x |
| 31 |
j = 7 |
| 32 |
return |
| 33 |
entry sub3ent(x) bind(c, name="mySubEnt3") |
| 34 |
x = 77.0 |
| 35 |
end subroutine sub3 |
| 36 |
subroutine sub4(j) |
| 37 |
integer(c_int) :: j |
| 38 |
real(c_float) :: x |
| 39 |
j = 8 |
| 40 |
return |
| 41 |
entry sub4ent(x) bind(c) |
| 42 |
x = 88.0 |
| 43 |
end subroutine sub4 |
| 44 |
|
| 45 |
integer(c_int) function func1() bind(c, name="myFunc1") |
| 46 |
real(c_float) :: func1ent |
| 47 |
func1 = -5 |
| 48 |
return |
| 49 |
entry func1ent() |
| 50 |
func1ent = -55.0 |
| 51 |
end function func1 |
| 52 |
integer(c_int) function func2() |
| 53 |
real(c_float) :: func2ent |
| 54 |
func2 = -6 |
| 55 |
return |
| 56 |
entry func2ent() bind(c, name="myFuncEnt2") |
| 57 |
func2ent = -66.0 |
| 58 |
end function func2 |
| 59 |
integer(c_int) function func3() bind(c, name="myFunc3") |
| 60 |
real(c_float) :: func3ent |
| 61 |
func3 = -7 |
| 62 |
return |
| 63 |
entry func3ent() bind(c, name="myFuncEnt3") |
| 64 |
func3ent = -77.0 |
| 65 |
end function func3 |
| 66 |
integer(c_int) function func4() |
| 67 |
real(c_float) :: func4ent |
| 68 |
func4 = -8 |
| 69 |
return |
| 70 |
entry func4ent() bind(c) |
| 71 |
func4ent = -88.0 |
| 72 |
end function func4 |
| 73 |
end module mod |