[PATCH] D92732: [Flang][OpenMP 4.5] Add semantic check for OpenMP Do Loop Constructs
Yashaswini Hegde via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Feb 2 09:05:14 PST 2021
yhegde added inline comments.
================
Comment at: flang/lib/Semantics/check-omp-structure.cpp:405
+ dir.source, llvm::omp::Directive::OMPD_threadprivate);
+ threadPrivateSymbols.clear();
+ const auto &list{std::get<parser::OmpObjectList>(x.t)};
----------------
kiranchandramohan wrote:
> This clear will cause programs with multiple declarations to not work properly. See example below.
> ```
> program omp_do
> integer, save:: i, j, k
> !$omp threadprivate(i)
> !$omp threadprivate(j)
> !$omp do collapse(2)
> do k = 1, 10
> do i = 1, 10
> print *, "Hello"
> end do
> end do
> !$omp end do
> end program omp_do
> ```
@kiranchandramohan . Thanks for pointing this out. Can I have the ThreadPrivate related check in resolve-directives.cpp or is it required to do in check-omp-structure.cpp as it is openmp specific. ?
For the test case given (if implemented in resolve-directives.cpp)
program omp_do
integer, save:: i, j, k
!$omp threadprivate(i)
!$omp threadprivate(j)
!$omp do collapse(2)
do k = 1, 10
do i = 1, 10
print *, "Hello"
end do
end do
!$omp end do
end program omp_do
This is the error thrown
/tp.f90:10:8: error: Loop iteration variable i is not allowed in THREADPRIVATE.
do i = 1, 10
^
and for omp-do04.f90
the errors are -
./omp-do04.f90:12:6: error: Loop iteration variable i is not allowed in THREADPRIVATE.
do i = 1, 10
^
./omp-do04.f90:14:8: error: Loop iteration variable j is not allowed in THREADPRIVATE.
do j = 1, 10
^
./omp-do04.f90:25:6: error: Loop iteration variable i is not allowed in THREADPRIVATE.
do i = 1, 10
^
./omp-do04.f90:26:8: error: Loop iteration variable j is not allowed in THREADPRIVATE.
do j = 1, 10
^
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92732/new/
https://reviews.llvm.org/D92732
More information about the llvm-commits
mailing list