Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Lower / module-and-internal-proc.f90
blob1da5ce422939741d0b05dc8813a853c1f20747af
1 ! Test that module data access are lowered correctly in the different
2 ! procedure contexts.
3 ! RUN: bbc -emit-fir %s -o - | FileCheck %s
5 module parent
6 integer :: i
7 contains
8 ! Test simple access to the module data
9 ! CHECK-LABEL: func @_QMparentPtest1
10 subroutine test1()
11 ! CHECK: fir.address_of(@_QMparentEi) : !fir.ref<i32>
12 print *, i
13 end subroutine
15 ! Test access to the module data inside an internal procedure where the
16 ! host is defined inside the module.
17 subroutine test2()
18 call test2internal()
19 contains
20 ! CHECK-LABEL: func @_QMparentFtest2Ptest2internal()
21 subroutine test2internal()
22 ! CHECK: fir.address_of(@_QMparentEi) : !fir.ref<i32>
23 print *, i
24 end subroutine
25 end subroutine
26 end module
28 ! Test access to the module data inside an internal procedure where the
29 ! host is using the module.
30 subroutine test3()
31 use parent
32 call test3internal()
33 contains
34 ! CHECK-LABEL: func @_QFtest3Ptest3internal()
35 subroutine test3internal()
36 ! CHECK: fir.address_of(@_QMparentEi) : !fir.ref<i32>
37 print *, i
38 end subroutine
39 end subroutine