[flang] Fix bug in rewriting function calls
authorTim Keith <tkeith@nvidia.com>
Thu, 6 Sep 2018 20:31:45 +0000 (13:31 -0700)
committerTim Keith <tkeith@nvidia.com>
Fri, 7 Sep 2018 16:31:02 +0000 (09:31 -0700)
Arrays are now represented with ObjectEntityDetails, not EntityDetails.
So that's what we have to look for when rewriting function calls to
array element references.

Original-commit: flang-compiler/f18@841b37d94bc02f5a8726873fff7182cee053c8c3
Reviewed-on: https://github.com/flang-compiler/f18/pull/177
Tree-same-pre-rewrite: false

flang/lib/semantics/rewrite-parse-tree.cc

index e793ae0..fde9ae4 100644 (file)
@@ -59,7 +59,7 @@ public:
     for (auto it{list.begin()}; it != list.end();) {
       if (auto stmt{std::get_if<stmtFuncType>(&it->u)}) {
         Symbol *symbol{std::get<parser::Name>(stmt->statement->t).symbol};
-        if (symbol && symbol->has<EntityDetails>()) {
+        if (symbol && symbol->has<ObjectEntityDetails>()) {
           // not a stmt func: remove it here and add to ones to convert
           stmtFuncsToConvert.push_back(std::move(*stmt));
           it = list.erase(it);
@@ -122,7 +122,7 @@ private:
     }
     parser::Name *name = std::get_if<parser::Name>(
         &std::get<parser::ProcedureDesignator>((*funcRef)->v.t).u);
-    if (!name || !name->symbol || !name->symbol->has<EntityDetails>()) {
+    if (!name || !name->symbol || !name->symbol->has<ObjectEntityDetails>()) {
       return;
     }
     x.u = common::Indirection{(*funcRef)->ConvertToArrayElementRef()};