[flang-commits] [PATCH] D131098: [flang] Allow assignment to host association in BLOCK in PURE subprogram

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Sun Aug 7 14:49:04 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rGe6373de53d35: [flang] Allow assignment to host association in BLOCK in PURE subprogram (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D131098/new/

https://reviews.llvm.org/D131098

Files:
  flang/include/flang/Semantics/tools.h
  flang/lib/Semantics/assignment.cpp
  flang/lib/Semantics/tools.cpp


Index: flang/lib/Semantics/tools.cpp
===================================================================
--- flang/lib/Semantics/tools.cpp
+++ flang/lib/Semantics/tools.cpp
@@ -255,6 +255,12 @@
       GetProgramUnitOrBlockConstructContaining(scope));
 }
 
+bool IsHostAssociatedIntoSubprogram(const Symbol &symbol, const Scope &scope) {
+  return DoesScopeContain(
+      &GetProgramUnitOrBlockConstructContaining(FollowHostAssoc(symbol)),
+      GetProgramUnitContaining(scope));
+}
+
 bool IsInStmtFunction(const Symbol &symbol) {
   if (const Symbol * function{symbol.owner().symbol()}) {
     return IsStmtFunction(*function);
Index: flang/lib/Semantics/assignment.cpp
===================================================================
--- flang/lib/Semantics/assignment.cpp
+++ flang/lib/Semantics/assignment.cpp
@@ -103,7 +103,7 @@
     const Symbol &x, const Scope &scope) {
   // See C1594, first paragraph.  These conditions enable checks on both
   // left-hand and right-hand sides in various circumstances.
-  if (IsHostAssociated(x, scope)) {
+  if (IsHostAssociatedIntoSubprogram(x, scope)) {
     return "host-associated";
   } else if (IsUseAssociated(x, scope)) {
     return "USE-associated";
Index: flang/include/flang/Semantics/tools.h
===================================================================
--- flang/include/flang/Semantics/tools.h
+++ flang/include/flang/Semantics/tools.h
@@ -88,6 +88,7 @@
 bool DoesScopeContain(const Scope *, const Symbol &);
 bool IsUseAssociated(const Symbol &, const Scope &);
 bool IsHostAssociated(const Symbol &, const Scope &);
+bool IsHostAssociatedIntoSubprogram(const Symbol &, const Scope &);
 inline bool IsStmtFunction(const Symbol &symbol) {
   const auto *subprogram{symbol.detailsIf<SubprogramDetails>()};
   return subprogram && subprogram->stmtFunction();


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D131098.450671.patch
Type: text/x-patch
Size: 1830 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220807/8fa4776f/attachment.bin>


More information about the flang-commits mailing list