[PATCH] D96686: [Flang][OpenMP 4.5] Add semantic check for OpenMP Do Loop Constructs for Threadprivate

Yashaswini Hegde via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 16 04:25:16 PST 2021


yhegde added a comment.

In D96686#2565173 <https://reviews.llvm.org/D96686#2565173>, @yhegde wrote:

> @kiranchandramohan , I was working with the following test case you have given ,
>
> module md
> integer :: i
> !$omp  threadprivate(i)
> end module
>
> program mn
> use md
> !$omp  do
> do i = 1, 10
>
>   do j = 1, 10
>     print *, "Hello"
>   end do
>
> end do
> !$omp end do
> end program
> +++++++++++++++++++++++++++
>
> The threadPrivateSymbol will get reset once the subroutine called up and it is set as OmpPredetermined and OmpPrivate and adjusted with in the DO loop region and it seems calling DeclareOrMarkOtherAccessEntity to set the Symbol flag to OmpThreadprivate and I think MakeAssocSymbol called with OmpPrivate to create HostAssocDetails. Then I am getting the symbol from HostAssocDtails and then checking whether it is OmpThreadprivate . Its working and throwing the following err.
>
> ./tpmodule.f90:9:4: error: Loop iteration variable i is not allowed in THREADPRIVATE.
>
>   do i = 1, 10 
>      ^
>    
>
> if this is the case , I suppose no where I need to call ClearThreadPrivateSymbols() because all the symbols in the threadPrivateSymbols are reset and new symbols get generated ( local copies probably ). Do you think I am missing anything ? Is this ok ? Please let me know.  Thank you.

But this code does not work if module.f90 contains 
module md
integer :: i
!$omp  threadprivate(i)
end module

and tp.f90 uses that module - like 
program mn
use md
!$omp  do
do i = 1, 10

  do j = 1, 10
    print *, "Hello"
  end do

end do
!$omp end do
end program

But gfortran gives error.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D96686/new/

https://reviews.llvm.org/D96686



More information about the llvm-commits mailing list