| 1 |
! Test instantiation of module variables inside an internal subprogram |
| 2 |
! where the use statement is inside the host program. |
| 3 |
! RUN: bbc -emit-hlfir -o - %s | FileCheck %s |
| 4 |
|
| 5 |
module module_used_by_host |
| 6 |
implicit none |
| 7 |
integer :: indexed_by_var(2) |
| 8 |
integer :: ref_in_implied_do |
| 9 |
integer :: ref_in_forall(2) |
| 10 |
end module |
| 11 |
|
| 12 |
subroutine host_procedure |
| 13 |
use module_used_by_host |
| 14 |
implicit none |
| 15 |
contains |
| 16 |
subroutine internal_procedure(i, mask) |
| 17 |
integer :: i |
| 18 |
logical :: mask(2) |
| 19 |
indexed_by_var(i) = 0 |
| 20 |
print *, (/(ref_in_implied_do, integer::j=1,10)/) |
| 21 |
forall (integer::k = 1:2) |
| 22 |
ref_in_forall(k) = 0 |
| 23 |
end forall |
| 24 |
end subroutine |
| 25 |
end subroutine |
| 26 |
! CHECK-LABEL: func.func private @_QFhost_procedurePinternal_procedure( |
| 27 |
! CHECK: fir.address_of(@_QMmodule_used_by_hostEindexed_by_var) : !fir.ref<!fir.array<2xi32>> |
| 28 |
! CHECK: fir.address_of(@_QMmodule_used_by_hostEref_in_forall) : !fir.ref<!fir.array<2xi32>> |
| 29 |
! CHECK: fir.address_of(@_QMmodule_used_by_hostEref_in_implied_do) : !fir.ref<i32> |