From e064f4f4b9e104360d57ff02ba93190fb56220ab Mon Sep 17 00:00:00 2001 From: Tim Keith Date: Wed, 24 Oct 2018 13:38:45 -0700 Subject: [PATCH] [flang] Fix bug in rewriting function reference `a(i)` is parsed as a function reference and needs to be converted to an array element reference when `a` is an object entity. That determination was wrong if the symbol for `a` was a symbol representing host-association or use-association. In that case we need to get to the original symbol by calling `GetUltimate()` on the symbol. This was causing symbol09.f90 to get a compilation error because an array element reference looked like a call to a non-pure function, which is prohibited inside a DO CONCURRENT. Original-commit: flang-compiler/f18@221e6c52c5460edfbec28904ebe1774ff787fc45 Reviewed-on: https://github.com/flang-compiler/f18/pull/216 --- flang/lib/semantics/rewrite-parse-tree.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flang/lib/semantics/rewrite-parse-tree.cc b/flang/lib/semantics/rewrite-parse-tree.cc index 07629616c837..be29f5a8b1d6 100644 --- a/flang/lib/semantics/rewrite-parse-tree.cc +++ b/flang/lib/semantics/rewrite-parse-tree.cc @@ -83,7 +83,8 @@ private: } parser::Name *name{std::get_if( &std::get((*funcRef)->v.t).u)}; - if (!name || !name->symbol || !name->symbol->has()) { + if (!name || !name->symbol || + !name->symbol->GetUltimate().has()) { return; } x.u = common::Indirection{(*funcRef)->ConvertToArrayElementRef()};