Files
clang-p2996/flang/test/Semantics/OpenMP/parallel-shared04.f90
Kiran Chandramohan 0661af893f [Flang][OpenMP] Add restriction about subobjects to firstprivate and … (#89608)
…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.
2024-04-23 12:56:52 +01:00

29 lines
687 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
type my_type
integer :: array(10)
end type my_type
type(my_type) :: my_var
real :: arr(10)
integer :: intx = 10
do i = 1, 10
arr(i) = 0.0
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(arr,intx,my_var%array(1))
do i = 1, 10
c(i) = a(i) + b(i) + k
my_var%array(i) = k+intx
arr(i) = k
end do
!$omp end parallel
end program omp_parallel_shared