58 lines · plain
1! RUN: %python %S/../test_errors.py %s %flang_fc1 -fopenmp2! OpenMP Version 4.53! 2.15.3.5 lastprivate Clause4! A variable that appears in a lastprivate clause must be definable.5 6module protected_var7 integer, protected :: p8end module protected_var9 10program omp_lastprivate11 use protected_var12 integer :: i, a(10), b(10), c(10)13 integer, parameter :: k = 1014 15 a = 1016 b = 2017 18 !ERROR: Variable 'k' on the LASTPRIVATE clause is not definable19 !BECAUSE: 'k' is not a variable20 !$omp parallel do lastprivate(k)21 do i = 1, 1022 c(i) = a(i) + b(i) + k23 end do24 !$omp end parallel do25 26 !ERROR: Variable 'p' on the LASTPRIVATE clause is not definable27 !BECAUSE: 'p' is protected in this scope28 !$omp parallel do lastprivate(p)29 do i = 1, 1030 c(i) = a(i) + b(i) + k31 end do32 !$omp end parallel do33 34 call omp_lastprivate_sb(i)35 36 print *, c37 38end program omp_lastprivate39 40subroutine omp_lastprivate_sb(m)41 integer :: i, a(10), b(10), c(10)42 integer, intent(in) :: m43 44 a = 1045 b = 2046 47 !ERROR: Variable 'm' on the LASTPRIVATE clause is not definable48 !BECAUSE: 'm' is an INTENT(IN) dummy argument49 !$omp parallel do lastprivate(m)50 do i = 1, 1051 c(i) = a(i) + b(i) + m52 end do53 !$omp end parallel do54 55 print *, c56 57end subroutine omp_lastprivate_sb58