1 ! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp
3 ! 2.15.3.5 lastprivate Clause
4 ! A variable that appears in a lastprivate clause must be definable.
7 integer, protected
:: p
8 end module protected_var
10 program omp_lastprivate
12 integer :: i
, a(10), b(10), c(10)
13 integer, parameter :: k
= 10
18 !ERROR: Variable 'k' on the LASTPRIVATE clause is not definable
19 !BECAUSE: 'k' is not a variable
20 !$omp parallel do lastprivate(k)
22 c(i
) = a(i
) + b(i
) + k
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)
30 c(i
) = a(i
) + b(i
) + k
34 call omp_lastprivate_sb(i
)
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
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)
51 c(i
) = a(i
) + b(i
) + m
57 end subroutine omp_lastprivate_sb