From ccb0b48805233d0d941c2414916b01d37b273ab9 Mon Sep 17 00:00:00 2001 From: Jean Perier Date: Tue, 20 Aug 2019 06:15:52 -0700 Subject: [PATCH] [flang] Handle AssocEntityDetails in mis-parsed function reference Fix issue flang-compiler/f18#574. Array references can be mistaken for function references during parsing. This is handled and fixed by semantics. however, if the symbol in the misparsed array reference was construct associated, then semantics was not handling the case correctly because semantics was only expecting `ObjectEntityDetails`. It was not possible to change the related `GetUltimate` into `GetAssociationRoot` because associated symbols are not always associated to another symbol (variable) but may be assoicated to an expression. Hence, this change allow `AssocEntityDetails` to be also accepted when dealing with array references misparsed as function references. Original-commit: flang-compiler/f18@b6a8b5f42bdb40d65f4c242a3673bc436a2d0601 Reviewed-on: https://github.com/flang-compiler/f18/pull/672 Tree-same-pre-rewrite: false --- flang/lib/semantics/expression.cc | 3 ++- flang/lib/semantics/resolve-names.cc | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/flang/lib/semantics/expression.cc b/flang/lib/semantics/expression.cc index e9bb82d35..290c9c1 100644 --- a/flang/lib/semantics/expression.cc +++ b/flang/lib/semantics/expression.cc @@ -1883,7 +1883,8 @@ static void FixMisparsedFunctionReference( }, proc.u)}) { Symbol &symbol{origSymbol->GetUltimate()}; - if (symbol.has()) { + if (symbol.has() || + symbol.has()) { if constexpr (common::HasMember, uType>) { CheckFuncRefToArrayElementRefHasSubscripts(context, funcRef); diff --git a/flang/lib/semantics/resolve-names.cc b/flang/lib/semantics/resolve-names.cc index 234fa0c..9bee59b 100644 --- a/flang/lib/semantics/resolve-names.cc +++ b/flang/lib/semantics/resolve-names.cc @@ -5063,7 +5063,8 @@ void ResolveNamesVisitor::HandleProcedureName( return; // reported error } if (IsProcedure(*symbol) || symbol->has() || - symbol->has()) { + symbol->has() || + symbol->has()) { // these are all valid as procedure-designators } else if (symbol->test(Symbol::Flag::Implicit)) { Say(name, -- 2.7.4