[Flang][OpenMP] Use the ultimate symbol in a call to the IsPointer function

The IsPointer check currently fails for host-associated symbols in OpenMP
regions. This causes some failures in semantic checks for pointer association
in an OpenMP region. Fix is to use the ultimate symbol in the call to the
IsPointer function in CheckPointerAssignment function in
lib/Semantics/pointer-assignment.cpp.

Reviewed By: klausler, peixin

Differential Revision: https://reviews.llvm.org/D112876
This commit is contained in:
Kiran Chandramohan 2021-11-04 17:50:20 +00:00
parent fe75d0c39c
commit 48dc5c8e73
2 changed files with 11 additions and 1 deletions

View File

@ -383,7 +383,7 @@ bool CheckPointerAssignment(evaluate::FoldingContext &context,
if (!pointer) {
return false; // error was reported
}
if (!IsPointer(*pointer)) {
if (!IsPointer(pointer->GetUltimate())) {
evaluate::SayWithDeclaration(context.messages(), *pointer,
"'%s' is not a pointer"_err_en_US, pointer->name());
return false;

View File

@ -0,0 +1,10 @@
! RUN: %flang_fc1 -fopenmp -fsyntax-only %s
subroutine s
integer, pointer :: p
integer, target :: t
!$omp parallel private(p)
p=>t
!$omp end parallel
end subroutine