Debian Codegraph @

flang/test/Lower/OpenMP/threadprivate-commonblock-use.f90

raw
1 ! This test checks lowering of OpenMP Threadprivate Directive.
2 ! Test for common block, defined in one module, used in a subroutine of
3 ! another module and privatized in a nested subroutine.
4
5 !RUN: %flang_fc1 -emit-hlfir -fopenmp %s -o - | FileCheck %s
6
7 !CHECK: fir.global common @cmn_(dense<0> : vector<4xi8>) {alignment = 4 : i64} : !fir.array<4xi8>
8 module m0
9 common /cmn/ k1
10 !$omp threadprivate(/cmn/)
11 end
12
13 module m1
14 contains
15 subroutine ss1
16 use m0
17 contains
18 !CHECK-LABEL: func private @_QMm1Fss1Pss2
19 !CHECK: %[[CMN:.*]] = fir.address_of(@cmn_) : !fir.ref<!fir.array<4xi8>>
20 !CHECK: omp.parallel
21 !CHECK: %{{.*}} = omp.threadprivate %[[CMN]] : !fir.ref<!fir.array<4xi8>> -> !fir.ref<!fir.array<4xi8>>
22 subroutine ss2
23 !$omp parallel copyin (k1)
24 !$omp end parallel
25 end subroutine ss2
26 end subroutine ss1
27 end
28
29 end