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