Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions flang/lib/Evaluate/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -566,13 +566,13 @@ MaybeExtentExpr GetExtent(const Subscript &subscript, const NamedEntity &base,
MaybeExtentExpr{triplet.stride()});
},
[&](const IndirectSubscriptIntegerExpr &subs) -> MaybeExtentExpr {
if (auto shape{GetShape(subs.value())}) {
if (GetRank(*shape) > 0) {
CHECK(GetRank(*shape) == 1); // vector-valued subscript
return std::move(shape->at(0));
}
if (auto shape{GetShape(subs.value())};
shape && GetRank(*shape) == 1) {
// vector-valued subscript
return std::move(shape->at(0));
} else {
return std::nullopt;
}
return std::nullopt;
},
},
subscript.u);
Expand Down
10 changes: 10 additions & 0 deletions flang/test/Semantics/bug121971.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
! RUN: %python %S/test_errors.py %s %flang_fc1
subroutine subr(a,b,n,m)
real n,m
!ERROR: Must have INTEGER type, but is REAL(4)
!ERROR: Must have INTEGER type, but is REAL(4)
integer a(n,m)
!ERROR: Rank of left-hand side is 2, but right-hand side has rank 1
!ERROR: Subscript expression has rank 2 greater than 1
a = a(a,j)
end
Loading