@@ -1077,20 +1077,24 @@ MaybeExpr ExpressionAnalyzer::Analyze(const parser::Name &n) {
1077
1077
n.symbol ->attrs ().reset (semantics::Attr::VOLATILE);
1078
1078
}
1079
1079
}
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 );
1089
1081
return Designate (DataRef{*n.symbol });
1090
1082
}
1091
1083
}
1092
1084
}
1093
1085
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
+
1094
1098
MaybeExpr ExpressionAnalyzer::Analyze (const parser::NamedConstant &n) {
1095
1099
auto restorer{GetContextualMessages ().SetLocation (n.v .source )};
1096
1100
if (MaybeExpr value{Analyze (n.v )}) {
@@ -3362,7 +3366,8 @@ const Assignment *ExpressionAnalyzer::Analyze(const parser::AssignmentStmt &x) {
3362
3366
ArgumentAnalyzer analyzer{*this };
3363
3367
const auto &variable{std::get<parser::Variable>(x.t )};
3364
3368
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);
3366
3371
std::optional<Assignment> assignment;
3367
3372
if (!analyzer.fatalErrors ()) {
3368
3373
auto restorer{GetContextualMessages ().SetLocation (variable.GetSource ())};
@@ -3392,6 +3397,8 @@ const Assignment *ExpressionAnalyzer::Analyze(const parser::AssignmentStmt &x) {
3392
3397
}
3393
3398
}
3394
3399
}
3400
+ CheckForWholeAssumedSizeArray (
3401
+ rhsExpr.source , UnwrapWholeSymbolDataRef (analyzer.GetExpr (1 )));
3395
3402
}
3396
3403
assignment.emplace (analyzer.MoveExpr (0 ), analyzer.MoveExpr (1 ));
3397
3404
if (procRef) {
0 commit comments