[WebAssembly] Fix asan issue from https://reviews.llvm.org/D121349
[llvm-project.git] / flang / test / Semantics / omp-lastprivate02.f90
blob61e232956565915cff8388890431233fbd88704a
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