70 lines · plain
1! RUN: bbc -emit-fir %s -o - | FileCheck %s2 3! Test lowering of module that defines data that is otherwise not used4! in this file.5 6! Module defines variable in common block without initializer7module modCommonNoInit18 ! Module variable is in blank common9 real :: x_blank10 common // x_blank11 ! Module variable is in named common, no init12 real :: x_named113 common /named1/ x_named114end module15! CHECK-LABEL: fir.global common @__BLNK__(dense<0> : vector<4xi8>) {alignment = 4 : i64} : !fir.array<4xi8>16! CHECK-LABEL: fir.global common @named1_(dense<0> : vector<4xi8>) {alignment = 4 : i64} : !fir.array<4xi8>17 18! Module defines variable in common block with initialization19module modCommonInit120 integer :: i_named2 = 4221 common /named2/ i_named222end module23! CHECK-LABEL: fir.global @named2_ {alignment = 4 : i64} : tuple<i32> {24 ! CHECK: %[[init:.*]] = fir.insert_value %{{.*}}, %c42{{.*}}, [0 : index] : (tuple<i32>, i32) -> tuple<i32>25 ! CHECK: fir.has_value %[[init]] : tuple<i32>26 27! Module m1 defines simple data28module m129 real :: x30 integer :: y(100)31end module32! CHECK: fir.global @_QMm1Ex : f3233! CHECK: fir.global @_QMm1Ey : !fir.array<100xi32>34 35! Module modEq1 defines data that is equivalenced and not used in this36! file.37module modEq138 ! Equivalence, no initialization39 real :: x1(10), x2(10), x3(10)40 ! Equivalence with initialization41 real :: y1 = 42.42 real :: y2(10)43 equivalence (x1(1), x2(5), x3(10)), (y1, y2(5))44end module45! CHECK-LABEL: fir.global @_QMmodeq1Ex1 : !fir.array<76xi8>46! CHECK-LABEL: fir.global @_QMmodeq1Ey1 : !fir.array<10xi32> {47 ! CHECK: %[[undef:.*]] = fir.undefined !fir.array<10xi32>48 ! CHECK: %[[v1:.*]] = fir.insert_on_range %0, %c0{{.*}} from (0) to (3) : (!fir.array<10xi32>, i32) -> !fir.array<10xi32>49 ! CHECK: %[[v2:.*]] = fir.insert_value %1, %c1109917696{{.*}}, [4 : index] : (!fir.array<10xi32>, i32) -> !fir.array<10xi32>50 ! CHECK: %[[v3:.*]] = fir.insert_on_range %2, %c0{{.*}} from (5) to (9) : (!fir.array<10xi32>, i32) -> !fir.array<10xi32>51 ! CHECK: fir.has_value %[[v3]] : !fir.array<10xi32>52 53! Test defining two module variables whose initializers depend on each others54! addresses.55module global_init_depending_on_each_other_address56 type a57 type(b), pointer :: pb58 end type59 type b60 type(a), pointer :: pa61 end type62 type(a), target :: xa63 type(b), target :: xb64 data xa, xb/a(xb), b(xa)/65end module66! CHECK-LABEL: fir.global @_QMglobal_init_depending_on_each_other_addressExb67 ! CHECK: fir.address_of(@_QMglobal_init_depending_on_each_other_addressExa)68! CHECK-LABEL: fir.global @_QMglobal_init_depending_on_each_other_addressExa69 ! CHECK: fir.address_of(@_QMglobal_init_depending_on_each_other_addressExb)70