Rebase.
[official-gcc.git] / gcc / testsuite / gfortran.dg / test_common_binding_labels_2_main.f03
blobfb7778effa0e0567e13c13a87a3934c1041c04d0
1 ! { dg-do compile }
2 ! { dg-options "-std=f2003" }
5 ! This file depends on the module test_common_binding_labels_2.  That module
6 ! must be compiled first and not be removed until after this test.
7 module test_common_binding_labels_2_main
8   use, intrinsic :: iso_c_binding, only: c_double, c_int
9   implicit none
10   
11   common /mycom/ r, s ! { dg-error "same binding name" }
12   real(c_double) :: r
13   real(c_double) :: s
14   ! this next line is an error; if a common block is bind(c), the binding label
15   ! for it must match across all scoping units that declare it.
16   bind(c, name="my_common_block_2") :: /mycom/ 
18   common /com2/ i ! { dg-error "same binding name" }
19   integer(c_int) :: i
20   bind(c, name="mycom2") /com2/
21 end module test_common_binding_labels_2_main
23 program main
24   use test_common_binding_labels_2 ! { dg-error "same binding name" }
25   use test_common_binding_labels_2_main ! { dg-error "same binding name" }
26 end program main
27 ! { dg-final { cleanup-modules "test_common_binding_labels_2" } }