1! { dg-do compile } 2module binding_label_tests 3 use, intrinsic :: iso_c_binding 4 implicit none 5 6 contains 7 8 subroutine c_sub() BIND(c, name = "C_Sub") 9 print *, 'hello from c_sub' 10 end subroutine c_sub 11 12 integer(c_int) function c_func() bind(C, name="__C_funC") 13 print *, 'hello from c_func' 14 c_func = 1 15 end function c_func 16 17 real(c_float) function f90_func() 18 print *, 'hello from f90_func' 19 f90_func = 1.0 20 end function f90_func 21 22 real(c_float) function c_real_func() bind(c) 23 print *, 'hello from c_real_func' 24 c_real_func = 1.5 25 end function c_real_func 26 27 integer function f90_func_0() result ( f90_func_0_result ) 28 print *, 'hello from f90_func_0' 29 f90_func_0_result = 0 30 end function f90_func_0 31 32 integer(c_int) function f90_func_1() result ( f90_func_1_result ) bind(c, name="__F90_Func_1__") 33 print *, 'hello from f90_func_1' 34 f90_func_1_result = 1 35 end function f90_func_1 36 37 integer(c_int) function f90_func_3() result ( f90_func_3_result ) bind(c) 38 print *, 'hello from f90_func_3' 39 f90_func_3_result = 3 40 end function f90_func_3 41 42 integer(c_int) function F90_func_2() bind(c) result ( f90_func_2_result ) 43 print *, 'hello from f90_func_2' 44 f90_func_2_result = 2 45 end function f90_func_2 46 47 integer(c_int) function F90_func_4() bind(c, name="F90_func_4") result ( f90_func_4_result ) 48 print *, 'hello from f90_func_4' 49 f90_func_4_result = 4 50 end function f90_func_4 51 52 integer(c_int) function F90_func_5() bind(c, name="F90_func_5") result ( f90_func_5_result ) 53 print *, 'hello from f90_func_5' 54 f90_func_5_result = 5 55 end function f90_func_5 56 57 subroutine c_sub_2() bind(c, name='c_sub_2') 58 print *, 'hello from c_sub_2' 59 end subroutine c_sub_2 60 61 subroutine c_sub_3() BIND(c, name = " C_Sub_3 ") 62 print *, 'hello from c_sub_3' 63 end subroutine c_sub_3 64 65 subroutine c_sub_5() BIND(c, name = "C_Sub_5 ") 66 print *, 'hello from c_sub_5' 67 end subroutine c_sub_5 68 69 ! nothing between the quotes except spaces, so name="". 70 ! the name will get set to the regularly mangled version of the name. 71 ! perhaps it should be marked with some characters that are invalid for 72 ! C names so C can not call it? 73 subroutine sub4() BIND(c, name = " ") 74 end subroutine sub4 75end module binding_label_tests 76