fix pr/45972
[official-gcc.git] / gcc / testsuite / gfortran.dg / bind_c_coms.f90
blobe88d56d182ca8dbcb5a754e005f4b7909d99abfb
1 ! { dg-do run }
2 ! { dg-additional-sources bind_c_coms_driver.c }
3 ! { dg-options "-w" }
4 ! the -w option is to prevent the warning about long long ints
5 module bind_c_coms
6 use, intrinsic :: iso_c_binding
7 implicit none
9 common /COM/ R, S
10 real(c_double) :: r
11 real(c_double) :: t
12 real(c_double) :: s
13 bind(c) :: /COM/, /SINGLE/, /MYCOM/
14 common /SINGLE/ T
15 common /MYCOM/ LONG_INTS
16 integer(c_long) :: LONG_INTS
17 common /MYCOM2/ LONG_LONG_INTS
18 integer(c_long_long) :: long_long_ints
19 bind(c) :: /mycom2/
21 common /com2/ i, j
22 integer(c_int) :: i, j
23 bind(c, name="f03_com2") /com2/
25 common /com3/ m, n
26 integer(c_int) :: m, n
27 bind(c, name="") /com3/
29 contains
30 subroutine test_coms() bind(c)
31 r = r + .1d0;
32 s = s + .1d0;
33 t = t + .1d0;
34 long_ints = long_ints + 1
35 long_long_ints = long_long_ints + 1
36 i = i + 1
37 j = j + 1
39 m = 1
40 n = 1
41 end subroutine test_coms
42 end module bind_c_coms
44 module bind_c_coms_2
45 use, intrinsic :: iso_c_binding, only: c_int
46 common /com3/ m, n
47 integer(c_int) :: m, n
48 bind(c, name="") /com3/
49 end module bind_c_coms_2
51 ! { dg-final { cleanup-modules "bind_c_coms bind_c_coms_2" } }