aboutsummaryrefslogtreecommitdiff
path: root/flang/lib/Semantics/pointer-assignment.cpp
diff options
context:
space:
mode:
authorPeter Klausler <pklausler@nvidia.com>2025-03-03 14:46:35 -0800
committerGitHub <noreply@github.com>2025-03-03 14:46:35 -0800
commit79a25e11fe119520e7cb70118df18e199217c891 (patch)
treed4ee888d82d4e014e8a4da3d07dfc99c336e1ef0 /flang/lib/Semantics/pointer-assignment.cpp
parentb2ba43a9c1193f1d90ad9d30dada85caebd2c56d (diff)
downloadllvm-79a25e11fe119520e7cb70118df18e199217c891.zip
llvm-79a25e11fe119520e7cb70118df18e199217c891.tar.gz
llvm-79a25e11fe119520e7cb70118df18e199217c891.tar.bz2
[flang] Further work on NULL(MOLD=allocatable) (#129345)
Refine handling of NULL(...) in semantics to properly distinguish NULL(), NULL(objectPointer), NULL(procPointer), and NULL(allocatable) from each other in relevant contexts. Add IsNullAllocatable() and IsNullPointerOrAllocatable() utility functions. IsNullAllocatable() is true only for NULL(allocatable); it is false for a bare NULL(), which can be detected independently with IsBareNullPointer(). IsNullPointer() now returns false for NULL(allocatable). ALLOCATED(NULL(allocatable)) now works, and folds to .FALSE. These utilities were modified to accept const pointer arguments rather than const references; I usually prefer this style when the result should clearly be false for a null argument (in the C sense), and it helped me find all of their use sites in the code.
Diffstat (limited to 'flang/lib/Semantics/pointer-assignment.cpp')
-rw-r--r--flang/lib/Semantics/pointer-assignment.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/flang/lib/Semantics/pointer-assignment.cpp b/flang/lib/Semantics/pointer-assignment.cpp
index 7f4548c..654c018 100644
--- a/flang/lib/Semantics/pointer-assignment.cpp
+++ b/flang/lib/Semantics/pointer-assignment.cpp
@@ -184,7 +184,7 @@ bool PointerAssignmentChecker::Check(const SomeExpr &rhs) {
if (!common::visit([&](const auto &x) { return Check(x); }, rhs.u)) {
return false;
}
- if (IsNullPointer(rhs)) {
+ if (IsNullPointer(&rhs)) {
return true;
}
if (lhs_ && IsProcedure(*lhs_)) {