mirror of
https://github.com/llvm/llvm-project.git
synced 2025-04-18 19:06:44 +00:00
[flang] Catch ASSOCIATE(x=>assumed_rank) (#100626)
An assumed-rank dummy argument cannot be the variable or expression in the selector of an ASSOCIATE construct. (SELECT TYPE/RANK are fine.)
This commit is contained in:
parent
fffbabfd47
commit
ed5a78a13f
@ -7121,9 +7121,13 @@ void ConstructVisitor::Post(const parser::AssociateStmt &x) {
|
||||
for (auto nthLastAssoc{assocCount}; nthLastAssoc > 0; --nthLastAssoc) {
|
||||
SetCurrentAssociation(nthLastAssoc);
|
||||
if (auto *symbol{MakeAssocEntity()}) {
|
||||
if (ExtractCoarrayRef(GetCurrentAssociation().selector.expr)) { // C1103
|
||||
const MaybeExpr &expr{GetCurrentAssociation().selector.expr};
|
||||
if (ExtractCoarrayRef(expr)) { // C1103
|
||||
Say("Selector must not be a coindexed object"_err_en_US);
|
||||
}
|
||||
if (evaluate::IsAssumedRank(expr)) {
|
||||
Say("Selector must not be assumed-rank"_err_en_US);
|
||||
}
|
||||
SetTypeFromAssociation(*symbol);
|
||||
SetAttrsFromAssociation(*symbol);
|
||||
}
|
||||
|
7
flang/test/Semantics/associate04.f90
Normal file
7
flang/test/Semantics/associate04.f90
Normal file
@ -0,0 +1,7 @@
|
||||
! RUN: %python %S/test_errors.py %s %flang_fc1
|
||||
subroutine bad(a)
|
||||
real :: a(..)
|
||||
!ERROR: Selector must not be assumed-rank
|
||||
associate(x => a)
|
||||
end associate
|
||||
end subroutine
|
Loading…
x
Reference in New Issue
Block a user