diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp --- a/flang/lib/Semantics/pointer-assignment.cpp +++ b/flang/lib/Semantics/pointer-assignment.cpp @@ -383,7 +383,7 @@ 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; diff --git a/flang/test/Semantics/omp-private-is-pointer-check.f90 b/flang/test/Semantics/omp-private-is-pointer-check.f90 new file mode 100644 --- /dev/null +++ b/flang/test/Semantics/omp-private-is-pointer-check.f90 @@ -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