[flang-commits] [flang] 12ba727 - [flang] Accept SIZE(assumed-rank, DIM=n)
peter klausler via flang-commits
flang-commits at lists.llvm.org
Fri Sep 17 09:00:49 PDT 2021
Author: peter klausler
Date: 2021-09-17T09:00:40-07:00
New Revision: 12ba72789747b3e177349f04deb30afb410292c2
URL: https://github.com/llvm/llvm-project/commit/12ba72789747b3e177349f04deb30afb410292c2
DIFF: https://github.com/llvm/llvm-project/commit/12ba72789747b3e177349f04deb30afb410292c2.diff
LOG: [flang] Accept SIZE(assumed-rank, DIM=n)
Silence a bogus error message about an out-of-range DIM= argument
when the argument is assumed-rank. (More generally, don't pretend
to be able to discern a shape of known rank for an assumed-rank
object.)
Differential Revision: https://reviews.llvm.org/D109915
Added:
Modified:
flang/lib/Evaluate/shape.cpp
Removed:
################################################################################
diff --git a/flang/lib/Evaluate/shape.cpp b/flang/lib/Evaluate/shape.cpp
index 7c5f517b92dbc..8919038d7ec90 100644
--- a/flang/lib/Evaluate/shape.cpp
+++ b/flang/lib/Evaluate/shape.cpp
@@ -500,6 +500,8 @@ auto GetShapeHelper::operator()(const Symbol &symbol) const -> Result {
[&](const semantics::ObjectEntityDetails &object) {
if (IsImpliedShape(symbol) && object.init()) {
return (*this)(object.init());
+ } else if (IsAssumedRank(symbol)) {
+ return Result{};
} else {
int n{object.shape().Rank()};
NamedEntity base{symbol};
@@ -517,12 +519,12 @@ auto GetShapeHelper::operator()(const Symbol &symbol) const -> Result {
}
},
[&](const semantics::AssocEntityDetails &assoc) {
- if (!assoc.rank()) {
- return (*this)(assoc.expr());
- } else {
+ if (assoc.rank()) { // SELECT RANK case
int n{assoc.rank().value()};
NamedEntity base{symbol};
return Result{CreateShape(n, base)};
+ } else {
+ return (*this)(assoc.expr());
}
},
[&](const semantics::SubprogramDetails &subp) {
More information about the flang-commits
mailing list