[flang-commits] [PATCH] D109915: flang] Accept SIZE(assumed-rank, DIM=n)
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Thu Sep 16 13:11:18 PDT 2021
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.
[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.)
https://reviews.llvm.org/D109915
Files:
flang/lib/Evaluate/shape.cpp
Index: flang/lib/Evaluate/shape.cpp
===================================================================
--- flang/lib/Evaluate/shape.cpp
+++ flang/lib/Evaluate/shape.cpp
@@ -500,6 +500,8 @@
[&](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 @@
}
},
[&](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) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109915.373046.patch
Type: text/x-patch
Size: 1106 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210916/9d90e3f0/attachment.bin>
More information about the flang-commits
mailing list