summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gfortran.dg/bind_c_coms.f90
diff options
context:
space:
mode:
authorupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
committerupstream source tree <ports@midipix.org>2015-03-15 20:14:05 -0400
commit554fd8c5195424bdbcabf5de30fdc183aba391bd (patch)
tree976dc5ab7fddf506dadce60ae936f43f58787092 /gcc/testsuite/gfortran.dg/bind_c_coms.f90
downloadcbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.bz2
cbb-gcc-4.6.4-554fd8c5195424bdbcabf5de30fdc183aba391bd.tar.xz
obtained gcc-4.6.4.tar.bz2 from upstream website;upstream
verified gcc-4.6.4.tar.bz2.sig; imported gcc-4.6.4 source tree from verified upstream tarball. downloading a git-generated archive based on the 'upstream' tag should provide you with a source tree that is binary identical to the one extracted from the above tarball. if you have obtained the source via the command 'git clone', however, do note that line-endings of files in your working directory might differ from line-endings of the respective files in the upstream repository.
Diffstat (limited to 'gcc/testsuite/gfortran.dg/bind_c_coms.f90')
-rw-r--r--gcc/testsuite/gfortran.dg/bind_c_coms.f9051
1 files changed, 51 insertions, 0 deletions
diff --git a/gcc/testsuite/gfortran.dg/bind_c_coms.f90 b/gcc/testsuite/gfortran.dg/bind_c_coms.f90
new file mode 100644
index 000000000..e88d56d18
--- /dev/null
+++ b/gcc/testsuite/gfortran.dg/bind_c_coms.f90
@@ -0,0 +1,51 @@
+! { dg-do run }
+! { dg-additional-sources bind_c_coms_driver.c }
+! { dg-options "-w" }
+! the -w option is to prevent the warning about long long ints
+module bind_c_coms
+ use, intrinsic :: iso_c_binding
+ implicit none
+
+ common /COM/ R, S
+ real(c_double) :: r
+ real(c_double) :: t
+ real(c_double) :: s
+ bind(c) :: /COM/, /SINGLE/, /MYCOM/
+ common /SINGLE/ T
+ common /MYCOM/ LONG_INTS
+ integer(c_long) :: LONG_INTS
+ common /MYCOM2/ LONG_LONG_INTS
+ integer(c_long_long) :: long_long_ints
+ bind(c) :: /mycom2/
+
+ common /com2/ i, j
+ integer(c_int) :: i, j
+ bind(c, name="f03_com2") /com2/
+
+ common /com3/ m, n
+ integer(c_int) :: m, n
+ bind(c, name="") /com3/
+
+contains
+ subroutine test_coms() bind(c)
+ r = r + .1d0;
+ s = s + .1d0;
+ t = t + .1d0;
+ long_ints = long_ints + 1
+ long_long_ints = long_long_ints + 1
+ i = i + 1
+ j = j + 1
+
+ m = 1
+ n = 1
+ end subroutine test_coms
+end module bind_c_coms
+
+module bind_c_coms_2
+ use, intrinsic :: iso_c_binding, only: c_int
+ common /com3/ m, n
+ integer(c_int) :: m, n
+ bind(c, name="") /com3/
+end module bind_c_coms_2
+
+! { dg-final { cleanup-modules "bind_c_coms bind_c_coms_2" } }