From 7c03f03c67da1e41ebe715dcde67baa7587eb734 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Fri, 19 Jul 2019 14:49:25 -0700 Subject: [PATCH] [flang] Do not add invalid subscript triple to whole assumed-size array reference Original-commit: flang-compiler/f18@71c134a55206c173acabe02bfd863080f1625117 Reviewed-on: https://github.com/flang-compiler/f18/pull/597 Tree-same-pre-rewrite: false --- flang/lib/semantics/expression.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/flang/lib/semantics/expression.cc b/flang/lib/semantics/expression.cc index 1a91240..262a426 100644 --- a/flang/lib/semantics/expression.cc +++ b/flang/lib/semantics/expression.cc @@ -156,6 +156,11 @@ MaybeExpr ExpressionAnalyzer::CompleteSubscripts(ArrayRef &&ref) { int symbolRank{symbol.Rank()}; int subscripts{static_cast(ref.size())}; if (subscripts == 0) { + if (semantics::IsAssumedSizeArray(symbol)) { + // Don't introduce a triplet that would later be caught + // as being invalid. + return Designate(DataRef{std::move(ref)}); + } // A -> A(:,:) for (; subscripts < symbolRank; ++subscripts) { ref.emplace_back(Triplet{}); -- 2.7.4