view gcc/testsuite/gfortran.dg/test_common_binding_labels_2_main.f03 @ 128:fe568345ddd5

fix CbC-example
author mir3636
date Wed, 11 Apr 2018 19:32:28 +0900
parents 04ced10e8804
children
line wrap: on
line source

! { dg-do compile }
! { dg-options "-std=f2003" }
! { dg-compile-aux-modules "test_common_binding_labels_2.f03" }
!
module test_common_binding_labels_2_main
  use, intrinsic :: iso_c_binding, only: c_double, c_int
  implicit none
  
  common /mycom/ r, s ! { dg-error "same binding name" }
  real(c_double) :: r
  real(c_double) :: s
  ! this next line is an error; if a common block is bind(c), the binding label
  ! for it must match across all scoping units that declare it.
  bind(c, name="my_common_block_2") :: /mycom/ 

  common /com2/ i ! { dg-error "same binding name" }
  integer(c_int) :: i
  bind(c, name="mycom2") /com2/
end module test_common_binding_labels_2_main

program main
  use test_common_binding_labels_2 ! { dg-error "same binding name" }
  use test_common_binding_labels_2_main ! { dg-error "same binding name" }
end program main
! { dg-final { cleanup-modules "test_common_binding_labels_2" } }