PR fortran/56408
[official-gcc.git] / gcc / testsuite / gfortran.dg / test_common_binding_labels_2_main.f03
blobcd1664137baa1e6b4535afc290a5228e0fb048c3
1 ! { dg-do compile }
2 ! { dg-options "-std=f2003" }
3 ! { dg-compile-aux-modules "test_common_binding_labels_2.f03" }
5 module test_common_binding_labels_2_main
6   use, intrinsic :: iso_c_binding, only: c_double, c_int
7   implicit none
8   
9   common /mycom/ r, s ! { dg-error "same binding name" }
10   real(c_double) :: r
11   real(c_double) :: s
12   ! this next line is an error; if a common block is bind(c), the binding label
13   ! for it must match across all scoping units that declare it.
14   bind(c, name="my_common_block_2") :: /mycom/ 
16   common /com2/ i ! { dg-error "same binding name" }
17   integer(c_int) :: i
18   bind(c, name="mycom2") /com2/
19 end module test_common_binding_labels_2_main
21 program main
22   use test_common_binding_labels_2 ! { dg-error "same binding name" }
23   use test_common_binding_labels_2_main ! { dg-error "same binding name" }
24 end program main
25 ! { dg-final { cleanup-modules "test_common_binding_labels_2" } }