[flang-commits] [flang] 026d880 - [flang] Add missing check for unresolved name
Tim Keith via flang-commits
flang-commits at lists.llvm.org
Thu Apr 23 07:01:55 PDT 2020
Author: Tim Keith
Date: 2020-04-23T07:00:38-07:00
New Revision: 026d8807f439754d0ac8e600c1c40538b1a16f02
URL: https://github.com/llvm/llvm-project/commit/026d8807f439754d0ac8e600c1c40538b1a16f02
DIFF: https://github.com/llvm/llvm-project/commit/026d8807f439754d0ac8e600c1c40538b1a16f02.diff
LOG: [flang] Add missing check for unresolved name
Summary:
The name in an InputItem isn't necessarily resolved if an error occurred,
so it needs to be checked.
Fixes https://bugs.llvm.org/show_bug.cgi?id=45477
Reviewers: klausler, PeteSteinfeld, DavidTruby, jdoerfert, sscalpone
Reviewed By: klausler, sscalpone
Subscribers: llvm-commits
Tags: #llvm, #flang
Differential Revision: https://reviews.llvm.org/D78685
Added:
Modified:
flang/lib/Semantics/check-io.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-io.cpp b/flang/lib/Semantics/check-io.cpp
index a1305ae61f25..250ad492ebc9 100644
--- a/flang/lib/Semantics/check-io.cpp
+++ b/flang/lib/Semantics/check-io.cpp
@@ -283,15 +283,17 @@ void IoChecker::Enter(const parser::InputItem &spec) {
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
+ }
}
}
}
More information about the flang-commits
mailing list