1! { dg-do run } 2! { dg-additional-sources bind_c_vars_driver.c } 3module bind_c_vars 4 use, intrinsic :: iso_c_binding 5 implicit none 6 7 integer(c_int), bind(c) :: myF90Int 8 real(c_float), bind(c, name="myF90Real") :: f90_real 9 integer(c_int) :: c2 10 integer(c_int) :: c3 11 integer(c_int) :: c4 12 bind(c, name="myVariable") :: c2 13 bind(c) c3, c4 14 15 integer(c_int), bind(c, name="myF90Array3D") :: A(18, 3:7, 10) 16 integer(c_int), bind(c, name="myF90Array2D") :: B(3, 2) 17 18contains 19 20 subroutine changeF90Globals() bind(c, name='changeF90Globals') 21 implicit none 22 ! should make it 2 23 myF90Int = myF90Int + 1 24 ! should make it 3.0 25 f90_real = f90_real * 3.0; 26 ! should make it 4 27 c2 = c2 * 2; 28 ! should make it 6 29 c3 = c3 + 3; 30 ! should make it 2 31 c4 = c4 / 2; 32 ! should make it 2 33 A(5, 6, 3) = A(5, 6, 3) + 1 34 ! should make it 3 35 B(3, 2) = B(3, 2) + 1 36 end subroutine changeF90Globals 37 38end module bind_c_vars 39