llvm-capstone/flang/test/Semantics/omp-parallel-shared01.f90
PeixinQiao 2685212184 [flang][OpenMP] Add semantic check for threadprivate directive
This patch implements the following check for THREADPRIVATE construct:
```
A variable that is part of another variable (as an array, structure
element or type parameter inquiry) cannot appear in a threadprivate
directive.
```

Reviewed By: kiranchandramohan

Differential Revision: https://reviews.llvm.org/D109685
2021-09-15 00:22:03 +08:00

21 lines
578 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
!ERROR: A variable that is part of another variable (as an array or structure element) cannot appear in a PRIVATE or SHARED clause
!$omp parallel shared(my_var%array)
do i = 1, 10
c(i) = a(i) + b(i) + k
my_var%array(i) = k
end do
!$omp end parallel
end program omp_parallel_shared