Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gfortran.dg / test_common_binding_labels.f03
blobea9a59a35e4cb8ab55a233d2fe94dc0123084af9
1 ! { dg-do compile }
2 module x
3   use, intrinsic :: iso_c_binding, only: c_double
4   implicit none
6   common /mycom/ r, s ! { dg-error "does not match" }
7   real(c_double) :: r
8   real(c_double) :: s
9   bind(c, name="my_common_block") :: /mycom/
10 end module x
12 module y
13   use, intrinsic :: iso_c_binding, only: c_double, c_int
14   implicit none
15   
16   common /mycom/ r, s
17   real(c_double) :: r
18   real(c_double) :: s
19   bind(c, name="my_common_block") :: /mycom/
21   common /com2/ i ! { dg-error "does not match" }
22   integer(c_int) :: i
23   bind(c, name="") /com2/
24 end module y
26 module z
27   use, intrinsic :: iso_c_binding, only: c_double, c_int
28   implicit none
29   
30   common /mycom/ r, s ! { dg-error "does not match" }
31   real(c_double) :: r
32   real(c_double) :: s
33   ! this next line is an error; if a common block is bind(c), the binding label
34   ! for it must match across all scoping units that declare it.
35   bind(c, name="my_common_block_2") :: /mycom/ 
37   common /com2/ i ! { dg-error "does not match" }
38   integer(c_int) :: i
39   bind(c, name="mycom2") /com2/
40 end module z
42 ! { dg-final { cleanup-modules "x y" } }