[flang-commits] [PATCH] D132166: [flang] Accept a null pointer as a NULL(MOLD=...) actual argument
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Aug 18 15:29:32 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG148116ab83a6: [flang] Accept a null pointer as a NULL(MOLD=...) actual argument (authored by klausler).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D132166/new/
https://reviews.llvm.org/D132166
Files:
flang/lib/Evaluate/intrinsics.cpp
Index: flang/lib/Evaluate/intrinsics.cpp
===================================================================
--- flang/lib/Evaluate/intrinsics.cpp
+++ flang/lib/Evaluate/intrinsics.cpp
@@ -2084,11 +2084,11 @@
if (CheckAndRearrangeArguments(arguments, context.messages(), keywords, 1) &&
arguments[0]) {
if (Expr<SomeType> * mold{arguments[0]->UnwrapExpr()}) {
- bool goodProcPointer{true};
- if (IsAllocatableOrPointer(*mold)) {
+ bool isProcPtrTarget{IsProcedurePointerTarget(*mold)};
+ if (isProcPtrTarget || IsAllocatableOrPointerObject(*mold, context)) {
characteristics::DummyArguments args;
std::optional<characteristics::FunctionResult> fResult;
- if (IsProcedurePointerTarget(*mold)) {
+ if (isProcPtrTarget) {
// MOLD= procedure pointer
const Symbol *last{GetLastSymbol(*mold)};
CHECK(last);
@@ -2101,8 +2101,6 @@
args.emplace_back("mold"s,
characteristics::DummyProcedure{common::Clone(*procPointer)});
fResult.emplace(std::move(*procPointer));
- } else {
- goodProcPointer = false;
}
} else if (auto type{mold->GetType()}) {
// MOLD= object pointer
@@ -2115,7 +2113,7 @@
context.messages().Say(arguments[0]->sourceLocation(),
"MOLD= argument to NULL() lacks type"_err_en_US);
}
- if (goodProcPointer) {
+ if (fResult) {
fResult->attrs.set(characteristics::FunctionResult::Attr::Pointer);
characteristics::Procedure::Attrs attrs;
attrs.set(characteristics::Procedure::Attr::NullPointer);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132166.453815.patch
Type: text/x-patch
Size: 1674 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220818/033048cb/attachment-0001.bin>
More information about the flang-commits
mailing list