[PATCH] D77814: [flang] Add missing check for unresolved name
Tim Keith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 9 11:17:42 PDT 2020
tskeith created this revision.
tskeith added a reviewer: sscalpone.
tskeith added a project: Flang.
Herald added a reviewer: jdoerfert.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The name in an InputItem isn't necessarily resolved if an error occurred, so it needs to be checked.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D77814
Files:
flang/lib/Semantics/check-io.cpp
Index: flang/lib/Semantics/check-io.cpp
===================================================================
--- flang/lib/Semantics/check-io.cpp
+++ flang/lib/Semantics/check-io.cpp
@@ -283,15 +283,17 @@
flags_.set(Flag::DataList);
if (const parser::Variable * var{std::get_if<parser::Variable>(&spec.u)}) {
const parser::Name &name{GetLastName(*var)};
- if (auto *details{name.symbol->detailsIf<ObjectEntityDetails>()}) {
- // TODO: Determine if this check is needed at all, and if so, replace
- // the false subcondition with a check for a whole array. Otherwise,
- // the check incorrectly flags array element and section references.
- if (details->IsAssumedSize() && false) {
- // This check may be superseded by C928 or C1002.
- context_.Say(name.source,
- "'%s' must not be a whole assumed size array"_err_en_US,
- name.source); // C1231
+ if (name.symbol) {
+ if (auto *details{name.symbol->detailsIf<ObjectEntityDetails>()}) {
+ // TODO: Determine if this check is needed at all, and if so, replace
+ // the false subcondition with a check for a whole array. Otherwise,
+ // the check incorrectly flags array element and section references.
+ if (details->IsAssumedSize() && false) {
+ // This check may be superseded by C928 or C1002.
+ context_.Say(name.source,
+ "'%s' must not be a whole assumed size array"_err_en_US,
+ name.source); // C1231
+ }
}
}
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77814.256338.patch
Type: text/x-patch
Size: 1540 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200409/5668b54d/attachment.bin>
More information about the llvm-commits
mailing list