[HLSL] Implement RWBuffer::operator[] via __builtin_hlsl_resource_getpointer (#117017)
[llvm-project.git] / flang / test / Semantics / OpenMP / lastprivate01.f90
blob4fae4829d8862eee4c5f39cb70277e1113b91aeb
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 variable that appears in a lastprivate clause must be definable.
6 module protected_var
7 integer, protected :: p
8 end module protected_var
10 program omp_lastprivate
11 use protected_var
12 integer :: i, a(10), b(10), c(10)
13 integer, parameter :: k = 10
15 a = 10
16 b = 20
18 !ERROR: Variable 'k' on the LASTPRIVATE clause is not definable
19 !BECAUSE: 'k' is not a variable
20 !$omp parallel do lastprivate(k)
21 do i = 1, 10
22 c(i) = a(i) + b(i) + k
23 end do
24 !$omp end parallel do
26 !ERROR: Variable 'p' on the LASTPRIVATE clause is not definable
27 !BECAUSE: 'p' is protected in this scope
28 !$omp parallel do lastprivate(p)
29 do i = 1, 10
30 c(i) = a(i) + b(i) + k
31 end do
32 !$omp end parallel do
34 call omp_lastprivate_sb(i)
36 print *, c
38 end program omp_lastprivate
40 subroutine omp_lastprivate_sb(m)
41 integer :: i, a(10), b(10), c(10)
42 integer, intent(in) :: m
44 a = 10
45 b = 20
47 !ERROR: Variable 'm' on the LASTPRIVATE clause is not definable
48 !BECAUSE: 'm' is an INTENT(IN) dummy argument
49 !$omp parallel do lastprivate(m)
50 do i = 1, 10
51 c(i) = a(i) + b(i) + m
52 end do
53 !$omp end parallel do
55 print *, c
57 end subroutine omp_lastprivate_sb