Break circular dependency between FIR dialect and utilities
[llvm-project.git] / flang / test / Semantics / OpenMP / lastprivate02.f90
blobc5bf9d7f50d04e8985f538a5dcf6c402b210d154
1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
2 ! OpenMP Version 4.5
3 ! 2.15.3.5 lastprivate Clause
4 ! A list item that is private within a parallel region, or that appears in
5 ! reduction clause of a parallel construct, must not appear in a
6 ! lastprivate clause on a worksharing construct if any of the corresponding
7 ! worksharing regions ever binds to any of the corresponding parallel regions.
9 program omp_lastprivate
10 integer :: a(10), b(10), c(10)
12 a = 10
13 b = 20
15 !$omp parallel reduction(+:a)
16 !ERROR: LASTPRIVATE variable 'a' is PRIVATE in outer context
17 !$omp sections lastprivate(a, b)
18 !$omp section
19 c = a + b
20 !$omp end sections
21 !$omp end parallel
23 !$omp parallel private(a,b)
24 !ERROR: LASTPRIVATE variable 'a' is PRIVATE in outer context
25 !ERROR: LASTPRIVATE variable 'b' is PRIVATE in outer context
26 !$omp do lastprivate(a,b)
27 do i = 1, 10
28 c(i) = a(i) + b(i) + i
29 end do
30 !$omp end do
31 !$omp end parallel
33 print *, c
35 end program omp_lastprivate