82 lines · plain
1! REQUIRES: flang-supports-f128-math2! RUN: bbc %s -o - | tco | FileCheck %s3! RUN: %flang -emit-llvm -S -mmlir -disable-external-name-interop %s -o - | FileCheck %s4 5! CHECK: @__BLNK__ = common global [8 x i8] zeroinitializer6! CHECK: @co1_ = common global [16 x i8] zeroinitializer, align 167! CHECK: @rien_ = common global [1 x i8] zeroinitializer8! CHECK: @with_empty_equiv_ = common global [8 x i8] zeroinitializer9! CHECK: @x_ = global { float, float } { float 1.0{{.*}}, float 2.0{{.*}} }10! CHECK: @y_ = common global [12 x i8] zeroinitializer11! CHECK: @z_ = global { i32, [4 x i8], float } { i32 42, [4 x i8] zeroinitializer, float 3.000000e+00 }12 13! CHECK-LABEL: _QPs014subroutine s015 common // a0, b016 17 ! CHECK: call void @_QPs(ptr @__BLNK__, ptr getelementptr inbounds nuw (i8, ptr @__BLNK__, i64 4))18 call s(a0, b0)19end subroutine s020 21! CHECK-LABEL: _QPs122subroutine s123 common /x/ a1, b124 data a1 /1.0/, b1 /2.0/25 26 ! CHECK: call void @_QPs(ptr @x_, ptr getelementptr inbounds nuw (i8, ptr @x_, i64 4))27 call s(a1, b1)28end subroutine s129 30! CHECK-LABEL: _QPs231subroutine s232 common /y/ a2, b2, c233 34 ! CHECK: call void @_QPs(ptr @y_, ptr getelementptr inbounds nuw (i8, ptr @y_, i64 4))35 call s(a2, b2)36end subroutine s237 38! Test that common initialized through aliases of common members are getting39! the correct initializer.40! CHECK-LABEL: _QPs341subroutine s342 integer :: i = 4243 real :: x44 complex :: c45 real :: glue(2)46 real :: y = 3.47 equivalence (i, x), (glue(1), c), (glue(2), y)48 ! x and c are not directly initialized, but overlapping aliases are.49 common /z/ x, c50end subroutine s351 52module mod_with_common53 integer :: i, j54 common /c_in_mod/ i, j55end module56! CHECK-LABEL: _QPs457subroutine s458 use mod_with_common59 ! CHECK: load i32, ptr @c_in_mod_60 print *, i61 ! CHECK: load i32, ptr getelementptr inbounds nuw (i8, ptr @c_in_mod_, i64 4)62 print *, j63end subroutine s464 65! CHECK-LABEL: _QPs566subroutine s567 real r(1:0)68 common /rien/ r69end subroutine s570 71! CHECK-LABEL: _QPs672subroutine s673 real r1(1:0), r2(1:0), x, y74 common /with_empty_equiv/ x, r1, y75 equivalence(r1, r2)76end subroutine s677 78subroutine s7()79 real(16) r1680 common /co1/ r1681end subroutine82