1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
3 ! 5.1.1 - Variables Referenced in a Construct
4 ! Copyprivate must accept variables that are predetermined as private.
10 program omp_copyprivate
17 real, parameter :: pi
= 3.14
20 ! Local variables are private.
23 !$omp end single copyprivate(i)
25 !$omp end single copyprivate(a1)
27 ! Variables with the SAVE attribute are not private.
29 !ERROR: COPYPRIVATE variable 'j' is not PRIVATE or THREADPRIVATE in outer context
30 !$omp end single copyprivate(j)
32 ! Common block variables are not private.
34 !ERROR: COPYPRIVATE variable 'k' is not PRIVATE or THREADPRIVATE in outer context
35 !$omp end single copyprivate(/c/)
37 !ERROR: COPYPRIVATE variable 'k' is not PRIVATE or THREADPRIVATE in outer context
38 !$omp end single copyprivate(k)
40 ! Module variables are not private.
42 !ERROR: COPYPRIVATE variable 'm' is not PRIVATE or THREADPRIVATE in outer context
43 !$omp end single copyprivate(m)
45 ! Parallel can make a variable shared.
49 !ERROR: COPYPRIVATE variable 'i' is not PRIVATE or THREADPRIVATE in outer context
50 !$omp end single copyprivate(i)
54 !$omp parallel shared(i)
57 !ERROR: COPYPRIVATE variable 'i' is not PRIVATE or THREADPRIVATE in outer context
58 !$omp end single copyprivate(i)
61 !FIXME: an error should be emitted in this case.
62 ! copyprivate(i) should be considered as a reference to i and a new
63 ! symbol should be created in `parallel` scope, for this case to be
67 !$omp end single copyprivate(i)
70 ! Named constants are shared.
72 !ERROR: COPYPRIVATE variable 'pi' is not PRIVATE or THREADPRIVATE in outer context
73 !$omp end single copyprivate(pi)
80 !ERROR: COPYPRIVATE variable 'i' is not PRIVATE or THREADPRIVATE in outer context
81 !$omp end single copyprivate(i)
93 !$omp end single copyprivate(s1)
95 ! Assumed shape arrays are shared.
97 !ERROR: COPYPRIVATE variable 'a' is not PRIVATE or THREADPRIVATE in outer context
98 !$omp end single copyprivate(a)
101 integer function fun(f1
)
106 !$omp end single copyprivate(f1)
108 ! Function result is private.
110 !$omp end single copyprivate(fun)