@@ -1077,20 +1077,24 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::Name &n) {
10771077 n.symbol ->attrs ().reset (semantics::Attr::VOLATILE);
10781078 }
10791079 }
1080- if (!isWholeAssumedSizeArrayOk_ &&
1081- semantics::IsAssumedSizeArray (
1082- ResolveAssociations (*n.symbol ))) { // C1002, C1014, C1231
1083- AttachDeclaration (
1084- SayAt (n,
1085- " Whole assumed-size array '%s' may not appear here without subscripts" _err_en_US,
1086- n.source ),
1087- *n.symbol );
1088- }
1080+ CheckForWholeAssumedSizeArray (n.source , n.symbol );
10891081 return Designate (DataRef{*n.symbol });
10901082 }
10911083 }
10921084}
10931085
1086+ void ExpressionAnalyzer::CheckForWholeAssumedSizeArray (
1087+ parser::CharBlock at, const Symbol *symbol) {
1088+ if (!isWholeAssumedSizeArrayOk_ && symbol &&
1089+ semantics::IsAssumedSizeArray (ResolveAssociations (*symbol))) {
1090+ AttachDeclaration (
1091+ SayAt (at,
1092+ " Whole assumed-size array '%s' may not appear here without subscripts" _err_en_US,
1093+ symbol->name ()),
1094+ *symbol);
1095+ }
1096+ }
1097+
10941098MaybeExpr ExpressionAnalyzer::Analyze (const parser::NamedConstant &n) {
10951099 auto restorer{GetContextualMessages ().SetLocation (n.v .source )};
10961100 if (MaybeExpr value{Analyze (n.v )}) {
@@ -3362,7 +3366,8 @@ const Assignment *ExpressionAnalyzer::Analyze(const parser::AssignmentStmt &x) {
33623366 ArgumentAnalyzer analyzer{*this };
33633367 const auto &variable{std::get<parser::Variable>(x.t )};
33643368 analyzer.Analyze (variable);
3365- analyzer.Analyze (std::get<parser::Expr>(x.t ));
3369+ const auto &rhsExpr{std::get<parser::Expr>(x.t )};
3370+ analyzer.Analyze (rhsExpr);
33663371 std::optional<Assignment> assignment;
33673372 if (!analyzer.fatalErrors ()) {
33683373 auto restorer{GetContextualMessages ().SetLocation (variable.GetSource ())};
@@ -3392,6 +3397,8 @@ const Assignment *ExpressionAnalyzer::Analyze(const parser::AssignmentStmt &x) {
33923397 }
33933398 }
33943399 }
3400+ CheckForWholeAssumedSizeArray (
3401+ rhsExpr.source , UnwrapWholeSymbolDataRef (analyzer.GetExpr (1 )));
33953402 }
33963403 assignment.emplace (analyzer.MoveExpr (0 ), analyzer.MoveExpr (1 ));
33973404 if (procRef) {
0 commit comments