Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
This reminds me another case as follows:
program main real(4), pointer::a allocate(a) a=1.0 !$omp parallel private(a) if (.not. associated(a)) then print *,'ng1: a' endif a=2.0 !$omp end parallel if (a /= 1.0) then print *, 'ng: a = ', a endif print *,'pass' end program main
$ flang-new -fc1 tmp.f90 -fopenmp error: Semantic errors in tmp.f90 ./tmp.f90:6:24: error: POINTER= argument of ASSOCIATED() must be a POINTER if (.not. associated(a)) then ^ ./tmp.f90:2:21: Declaration of 'a' real(4), pointer::a ^
Since we use host-association for privitized variables, is there one better way to handle these cases? I guess there are still some bugs if we make the changes in non-OpenMP function code.
Thanks @peixin, one option is to copy the attributes while making the associated symbol. But I was advised to instead use the UltimateSymbol way in https://reviews.llvm.org/D112876. I don't know of other general ways to handle these. You are right that there are some bugs. I hope we can catch these with widespread testing and careful reviews like yours. :)
Do you want me to make the change for pointer in this patch?
Thanks @peixin, one option is to copy the attributes while making the associated symbol. But I was advised to instead use the UltimateSymbol way in https://reviews.llvm.org/D112876. I don't know of other general ways to handle these. You are right that there are some bugs. I hope we can catch these with widespread testing and careful reviews like yours. :)
Thanks. Got it. That fix is too long ago and I forgot about it. Now this sounds reasonable to me.
Do you want me to make the change for pointer in this patch?
You can fix it in another patch, which may look more clear. Either way is OK to me.