[flang-commits] [flang] 787ee99 - [flang] Allow for host association in ConvertTo(Object|Proc)Entity

Peter Klausler via flang-commits flang-commits at lists.llvm.org
Wed Apr 27 12:30:12 PDT 2022


Author: Peter Klausler
Date: 2022-04-27T12:30:03-07:00
New Revision: 787ee99d4fd9fd45c9546202e9b73b01ce28c49e

URL: https://github.com/llvm/llvm-project/commit/787ee99d4fd9fd45c9546202e9b73b01ce28c49e
DIFF: https://github.com/llvm/llvm-project/commit/787ee99d4fd9fd45c9546202e9b73b01ce28c49e.diff

LOG: [flang] Allow for host association in ConvertTo(Object|Proc)Entity

Name resolution fails with a bogus "is not a variable" error message
when a host-associated object appears in a NAMELIST group.  The root
cause is that ConvertToObjectEntity() returns false for host-associated
objects.  Fix that, and also apply a similar fix to ConvertToProcEntity()
nearby.

Differential Revision: https://reviews.llvm.org/D124541

Added: 
    

Modified: 
    flang/lib/Semantics/resolve-names.cpp

Removed: 
    


################################################################################
diff  --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 3c7d052f13635..60820040dbe1a 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -2423,6 +2423,8 @@ bool ScopeHandler::ConvertToObjectEntity(Symbol &symbol) {
     symbol.set_details(ObjectEntityDetails{std::move(*details)});
   } else if (auto *useDetails{symbol.detailsIf<UseDetails>()}) {
     return useDetails->symbol().has<ObjectEntityDetails>();
+  } else if (auto *hostDetails{symbol.detailsIf<HostAssocDetails>()}) {
+    return hostDetails->symbol().has<ObjectEntityDetails>();
   } else {
     return false;
   }
@@ -2441,6 +2443,10 @@ bool ScopeHandler::ConvertToProcEntity(Symbol &symbol) {
       CHECK(!symbol.test(Symbol::Flag::Subroutine));
       symbol.set(Symbol::Flag::Function);
     }
+  } else if (auto *useDetails{symbol.detailsIf<UseDetails>()}) {
+    return useDetails->symbol().has<ProcEntityDetails>();
+  } else if (auto *hostDetails{symbol.detailsIf<HostAssocDetails>()}) {
+    return hostDetails->symbol().has<ProcEntityDetails>();
   } else {
     return false;
   }


        


More information about the flang-commits mailing list