[flang-commits] [flang] [flang][OpenACC] Release declare-create allocatable on deallocate (PR #220541)

Slava Zakharin via flang-commits flang-commits at lists.llvm.org
Wed Sep 2 09:18:49 PDT 2026


================
@@ -5334,6 +5336,12 @@ void Fortran::lower::attachDeclarePostDeallocAction(
   if (isUnifiedMemoryMode(converter))
     return;
 
+  // A module variable has no post-dealloc recipe: it would run once the
+  // descriptor no longer holds the address the mapping is keyed on.
+  if (sym.GetUltimate().owner().kind() ==
+      Fortran::semantics::Scope::Kind::Module)
+    return;
+
----------------
vzakhari wrote:

Thanks for the example! I wonder why we need `@_QFsEl_acc_declare_post_dealloc` - is that okay to have to `declare_exit`'s associated with the same deallocation of the local? I guess this is an offtopic for this PR, but maybe we need an issue for this...

https://github.com/llvm/llvm-project/pull/220541


More information about the flang-commits mailing list