[clangd] Re-land "support outgoing calls in call hierarchy" (#117673)
[llvm-project.git] / flang / test / Semantics / OpenMP / copyprivate03.f90
blob9d39fdb6b13c8696c7a5e591cbb610b86893cefc
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.15.4.2 copyprivate Clause
4 ! All list items that appear in the copyprivate clause must be either
5 ! threadprivate or private in the enclosing context.
7 program omp_copyprivate
8 integer :: a(10), b(10)
9 integer, save :: k
11 !$omp threadprivate(k)
13 k = 10
14 a = 10
15 b = a + 10
17 !$omp parallel
18 !$omp single
19 a = a + k
20 !$omp end single copyprivate(k)
21 !$omp single
22 b = b - a
23 !ERROR: COPYPRIVATE variable 'b' is not PRIVATE or THREADPRIVATE in outer context
24 !$omp end single copyprivate(b)
25 !$omp end parallel
27 !$omp parallel sections private(a)
28 !$omp section
29 !$omp parallel
30 !$omp single
31 a = a * b + k
32 !ERROR: COPYPRIVATE variable 'a' is not PRIVATE or THREADPRIVATE in outer context
33 !$omp end single copyprivate(a)
34 !$omp end parallel
35 !$omp end parallel sections
37 !The use of FIRSTPRIVATE with COPYPRIVATE is allowed
38 !$omp parallel firstprivate(a)
39 !$omp single
40 a = a + k
41 !$omp end single copyprivate(a)
42 !$omp end parallel
44 print *, a, b
46 end program omp_copyprivate