[flang] Fix bug in rewriting function reference
authorTim Keith <tkeith@nvidia.com>
Wed, 24 Oct 2018 20:38:45 +0000 (13:38 -0700)
committerTim Keith <tkeith@nvidia.com>
Wed, 24 Oct 2018 20:39:17 +0000 (13:39 -0700)
commite064f4f4b9e104360d57ff02ba93190fb56220ab
tree90d132ba002afaa54243e2ae4b0077350535bcf4
parentc87363805220e5372b731e73ed1c5fe6213f5d59
[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