brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.2 KiB · 3861e9e Raw
38 lines · plain
1! RUN: bbc -emit-hlfir %s -o - | FileCheck %s2 3! Test non standard definition of a common block as a BIND(C) variable.4! This happens when MPI and MPI_F08 are used inside the same compilation5! unit because MPI uses common blocks while MPI_F08 uses BIND(C) variables6! to refer to the same objects (e.g. mpi_argv_null).7 8module m_common_var9 character(1) :: var10 common /var_storage/var11end module12 13module m_bindc_var14  character(1), bind(c, name="var_storage_") :: var15end module16 17subroutine s1()18  use m_common_var, only : var19  var = "a"20end subroutine21 22subroutine s2()23  use m_bindc_var, only : var24  print *, var25end subroutine26 27  call s1()28  call s2()29end30 31! CHECK: fir.global common @var_storage_(dense<0> : vector<1xi8>) {alignment = 1 : i64} : !fir.array<1xi8>32 33! CHECK-LABEL: func.func @_QPs134! CHECK: hlfir.declare %{{.*}} typeparams %c1 storage(%{{.*}}[0]) {uniq_name = "_QMm_common_varEvar"} : (!fir.ref<!fir.char<1>>, index, !fir.ref<!fir.array<1xi8>>) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)35 36! CHECK-LABEL: func.func @_QPs237! CHECK: hlfir.declare %{{.*}} typeparams %c1 {fortran_attrs = #fir.var_attrs<bind_c>, uniq_name = "var_storage_"} : (!fir.ref<!fir.char<1>>, index) -> (!fir.ref<!fir.char<1>>, !fir.ref<!fir.char<1>>)38