diff --git a/flang/lib/Semantics/check-io.cpp b/flang/lib/Semantics/check-io.cpp --- a/flang/lib/Semantics/check-io.cpp +++ b/flang/lib/Semantics/check-io.cpp @@ -283,15 +283,17 @@ flags_.set(Flag::DataList); if (const parser::Variable * var{std::get_if(&spec.u)}) { const parser::Name &name{GetLastName(*var)}; - if (auto *details{name.symbol->detailsIf()}) { - // 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()}) { + // 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 + } } } }