[LoopReroll] Add an extra defensive check to avoid SCEV assertion.
[llvm-project.git] / flang / test / Semantics / omp-lastprivate02.f90
blobb17031875884da6235ce9bdf4f25e341d06a050f
1 ! RUN: %S/test_errors.sh %s %t %flang_fc1 -fopenmp
2 ! REQUIRES: shell
3 ! OpenMP Version 4.5
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)
13 a = 10
14 b = 20
16 !$omp parallel reduction(+:a)
17 !ERROR: LASTPRIVATE variable 'a' is PRIVATE in outer context
18 !$omp sections lastprivate(a, b)
19 !$omp section
20 c = a + b
21 !$omp end sections
22 !$omp end parallel
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)
28 do i = 1, 10
29 c(i) = a(i) + b(i) + i
30 end do
31 !$omp end do
32 !$omp end parallel
34 print *, c
36 end program omp_lastprivate