Fortran · 698 bytes Raw Blame History
1 ! audit31 Finding 4: `inner` inside `outer` inside `program` used
2 ! to lose `host_var` writes because the closure-passing walker
3 ! only collected refs against the IMMEDIATE host. Pass the full
4 ! ancestor decl chain into walk_contained_host_refs, and fold
5 ! each proc's nested-contained refs into its own so intermediate
6 ! levels carry the outer-scope vars as hidden params for
7 ! forwarding. Task #485.
8 ! CHECK: 20
9 program audit31_nested_host
10 implicit none
11 integer :: host_var = 10
12 call outer()
13 print *, 'final host_var=', host_var
14 contains
15 subroutine outer()
16 call inner()
17 contains
18 subroutine inner()
19 host_var = host_var * 2
20 end subroutine
21 end subroutine
22 end program
23