48 lines · plain
1! Test the mixing BIND(C) and non BIND(C) common blocks.2 3! RUN: %flang_fc1 -emit-llvm %s -o - 2>&1 | FileCheck %s --check-prefix=UNDERSCORING4! RUN: %flang_fc1 -emit-llvm -fno-underscoring %s -o - 2>&1 | FileCheck %s --check-prefix=NO-UNDERSCORING5 6! Scenario 1: Fortran symbols collide, but not the object file names, emit different7! globals for each common8subroutine bindc_common_with_same_fortran_name()9 real :: x10 common /com1/ x11 bind(c, name="not_com1") :: /com1/12 print *, x13end subroutine14 15subroutine bindc_common_with_same_fortran_name_2()16 real :: x(2), y(2)17 common /com1/ x18 print *, x19end subroutine20 21! Scenario 2: object file names of common block may collide (depending on22! underscoring option). Merge common block into a single global symbol.23subroutine bindc_common_colliding_with_normal_common()24 real :: x, y25 common /com3/ x26 common /com4/ y27 bind(c, name="some_common_") :: /com3/28 bind(c, name="__BLNK__") :: /com4/29 print *, x, y30end subroutine31subroutine bindc_common_colliding_with_normal_common_2()32 real :: x(2), y(2)33 common /some_common/ x34 common // y35 print *, x, y36end subroutine37 38! UNDERSCORING: @__BLNK__ = common global [8 x i8] zeroinitializer39! UNDERSCORING: @com1_ = common global [8 x i8] zeroinitializer40! UNDERSCORING: @not_com1 = common global [4 x i8] zeroinitializer41! UNDERSCORING: @some_common_ = common global [8 x i8] zeroinitializer42 43! NO-UNDERSCORING: @__BLNK__ = common global [8 x i8] zeroinitializer44! NO-UNDERSCORING: @com1 = common global [8 x i8] zeroinitializer45! NO-UNDERSCORING: @not_com1 = common global [4 x i8] zeroinitializer46! NO-UNDERSCORING: @some_common = common global [8 x i8] zeroinitializer47! NO-UNDERSCORING: @some_common_ = common global [4 x i8] zeroinitializer48