…lastprivate OpenMP 5.2 standard (Section 5.3) defines privatization for list items. Section 3.2.1 in the standard defines list items to exclude variables that are part of other variables. This patch adds the restriction to firstprivate and lastprivates, it was previously added for privates. Fixes https://github.com/llvm/llvm-project/issues/67227 Note: The specific checks that are added here are explicitly called out in OpenMP 4.0 (https://www.openmp.org/wp-content/uploads/OpenMP4.0.0.pdf) Sections 2.14.3.4 and 2.14.3.5 but in later standards have become implicit through other definitions.
21 lines
539 B
Fortran
21 lines
539 B
Fortran
!RUN: %python %S/../test_errors.py %s %flang -fopenmp
|
|
! OpenMP Version 4.5
|
|
! 2.15.3.2 parallel shared Clause
|
|
program omp_parallel_shared
|
|
integer :: i, j, a(10), b(10), c(10)
|
|
integer :: k = 10
|
|
integer :: array(10)
|
|
|
|
do i = 1, 10
|
|
array(i) = i
|
|
end do
|
|
|
|
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a SHARED clause
|
|
!$omp parallel shared(array(i))
|
|
do i = 1, 10
|
|
c(i) = a(i) + b(i) + k
|
|
array(i) = k
|
|
end do
|
|
!$omp end parallel
|
|
end program omp_parallel_shared
|