40 lines · plain
1! Test that module data access are lowered correctly in the different2! procedure contexts.3! RUN: bbc -emit-fir %s -o - | FileCheck %s4 5module parent6 integer :: i7contains8! Test simple access to the module data9! CHECK-LABEL: func @_QMparentPtest110subroutine test1()11 ! CHECK: fir.address_of(@_QMparentEi) : !fir.ref<i32>12 print *, i13end subroutine14 15! Test access to the module data inside an internal procedure where the16! host is defined inside the module.17subroutine test2()18 call test2internal()19 contains20 ! CHECK-LABEL: func private @_QMparentFtest2Ptest2internal()21 subroutine test2internal()22 ! CHECK: fir.address_of(@_QMparentEi) : !fir.ref<i32>23 print *, i24 end subroutine25end subroutine26end module27 28! Test access to the module data inside an internal procedure where the29! host is using the module.30subroutine test3()31 use parent32 call test3internal()33 contains34 ! CHECK-LABEL: func private @_QFtest3Ptest3internal()35 subroutine test3internal()36 ! CHECK: fir.address_of(@_QMparentEi) : !fir.ref<i32>37 print *, i38 end subroutine39end subroutine40