[flang-commits] [flang] 48dc5c8 - [Flang][OpenMP] Use the ultimate symbol in a call to the IsPointer function
Kiran Chandramohan via flang-commits
flang-commits at lists.llvm.org
Thu Nov 4 12:54:25 PDT 2021
Author: Kiran Chandramohan
Date: 2021-11-04T19:53:58Z
New Revision: 48dc5c8e731b1198c4ba4b2f08b235c55e6d5aef
URL: https://github.com/llvm/llvm-project/commit/48dc5c8e731b1198c4ba4b2f08b235c55e6d5aef
DIFF: https://github.com/llvm/llvm-project/commit/48dc5c8e731b1198c4ba4b2f08b235c55e6d5aef.diff
LOG: [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
Added:
flang/test/Semantics/omp-private-is-pointer-check.f90
Modified:
flang/lib/Semantics/pointer-assignment.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp
index 7003242304d5..0fe864308fdc 100644
--- a/flang/lib/Semantics/pointer-assignment.cpp
+++ b/flang/lib/Semantics/pointer-assignment.cpp
@@ -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;
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
index 000000000000..c2b7244e4648
--- /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
More information about the flang-commits
mailing list