[flang] Accept polymorphic component element in storage_size
[llvm-project.git] / flang / test / Semantics / OpenMP / omp-copyprivate03.f90
blobeccc308b1d5abdaa81a2046acc79dcbe561ba829
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 print *, a, b
39 end program omp_copyprivate