From: peter klausler Date: Tue, 10 Mar 2020 23:13:09 +0000 (-0700) Subject: [flang] Extend shape analysis to cope with ASSOCIATE construct entities better X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=886fb42ece8f3c1ca16b179efe993ee68d663fe8;p=platform%2Fupstream%2Fllvm.git [flang] Extend shape analysis to cope with ASSOCIATE construct entities better Fix incomplete copy&paste Another review comment addressed Original-commit: flang-compiler/f18@a2e2593fa5457a7737faab8ee74e5f3b18cd71f7 Reviewed-on: https://github.com/flang-compiler/f18/pull/1061 Tree-same-pre-rewrite: false --- diff --git a/flang/lib/Evaluate/shape.cpp b/flang/lib/Evaluate/shape.cpp index c523f30..c0b59cf 100644 --- a/flang/lib/Evaluate/shape.cpp +++ b/flang/lib/Evaluate/shape.cpp @@ -256,6 +256,13 @@ MaybeExtentExpr GetExtent( } } } + } else if (const auto *assoc{ + symbol.detailsIf()}) { + if (auto shape{GetShape(context, assoc->expr())}) { + if (dimension < static_cast(shape->size())) { + return std::move(shape->at(dimension)); + } + } } return std::nullopt; } @@ -316,6 +323,13 @@ MaybeExtentExpr GetUpperBound( } } } + } else if (const auto *assoc{ + symbol.detailsIf()}) { + if (auto shape{GetShape(context, assoc->expr())}) { + if (dimension < static_cast(shape->size())) { + return std::move(shape->at(dimension)); + } + } } return std::nullopt; }