1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
4 ! 2.15.3.5 lastprivate Clause
5 ! A list item that is private within a parallel region, or that appears in
6 ! reduction clause of a parallel construct, must not appear in a
7 ! lastprivate clause on a worksharing construct if any of the corresponding
8 ! worksharing regions ever binds to any of the corresponding parallel regions.
10 program omp_lastprivate
11 integer :: a(10), b(10), c(10)
16 !$omp parallel reduction(+:a)
17 !ERROR: LASTPRIVATE variable 'a' is PRIVATE in outer context
18 !$omp sections lastprivate(a, b)
24 !$omp parallel private(a,b)
25 !ERROR: LASTPRIVATE variable 'a' is PRIVATE in outer context
26 !ERROR: LASTPRIVATE variable 'b' is PRIVATE in outer context
27 !$omp do lastprivate(a,b)
29 c(i
) = a(i
) + b(i
) + i
36 end program omp_lastprivate