[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Lower / module_use.f90
blob6188a0064ce4c50e3fa4139f66b1aca062532a68
1 ! RUN: bbc -emit-fir %S/module_definition.f90
2 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
4 ! Test use of module data not defined in this file.
5 ! The modules are defined in module_definition.f90
6 ! The first runs ensures the module file is generated.
8 ! CHECK: fir.global common @_QB(dense<0> : vector<4xi8>) : !fir.array<4xi8>
9 ! CHECK-NEXT: fir.global common @_QBnamed1(dense<0> : vector<4xi8>) : !fir.array<4xi8>
10 ! CHECK-NEXT: fir.global common @_QBnamed2(dense<0> : vector<4xi8>) : !fir.array<4xi8>
12 ! CHECK-LABEL: func @_QPm1use()
13 real function m1use()
14 use m1
15 ! CHECK-DAG: fir.address_of(@_QMm1Ex) : !fir.ref<f32>
16 ! CHECK-DAG: fir.address_of(@_QMm1Ey) : !fir.ref<!fir.array<100xi32>>
17 m1use = x + y(1)
18 end function
20 ! TODO: test equivalences once front-end fix in module file is pushed.
21 !! CHECK-LABEL func @_QPmodeq1use()
22 !real function modEq1use()
23 ! use modEq1
24 ! ! CHECK-DAG fir.address_of(@_QMmodeq1Ex1) : !fir.ref<tuple<!fir.array<36xi8>, !fir.array<40xi8>>>
25 ! ! CHECK-DAG fir.address_of(@_QMmodeq1Ey1) : !fir.ref<tuple<!fir.array<16xi8>, !fir.array<24xi8>>>
26 ! modEq1use = x2(1) + y1
27 !end function
28 ! CHECK-DAG fir.global @_QMmodeq1Ex1 : tuple<!fir.array<36xi8>, !fir.array<40xi8>>
29 ! CHECK-DAG fir.global @_QMmodeq1Ey1 : tuple<!fir.array<16xi8>, !fir.array<24xi8>>
31 ! CHECK-LABEL: func @_QPmodcommon1use()
32 real function modCommon1Use()
33 use modCommonInit1
34 use modCommonNoInit1
35 ! CHECK-DAG: fir.address_of(@_QBnamed2) : !fir.ref<!fir.array<4xi8>>
36 ! CHECK-DAG: fir.address_of(@_QB) : !fir.ref<!fir.array<4xi8>>
37 ! CHECK-DAG: fir.address_of(@_QBnamed1) : !fir.ref<!fir.array<4xi8>>
38 modCommon1Use = x_blank + x_named1 + i_named2
39 end function
42 ! CHECK-DAG: fir.global @_QMm1Ex : f32
43 ! CHECK-DAG: fir.global @_QMm1Ey : !fir.array<100xi32>