[flang-commits] [flang] [Flang] Fix NULLIFY statement that returns too early for multiple procedure pointer objects. (PR #81164)

via flang-commits flang-commits at lists.llvm.org
Thu Feb 8 09:46:02 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-fir-hlfir

Author: Daniel Chen (DanielCChen)

<details>
<summary>Changes</summary>

The current code that handles NULLIFY statement for procedure pointer returns after the 1st object.
This PR is to remove the `return` so it can nullify multiple procedure pointer objects.

---
Full diff: https://github.com/llvm/llvm-project/pull/81164.diff


1 Files Affected:

- (modified) flang/lib/Lower/Bridge.cpp (+3-3) 


``````````diff
diff --git a/flang/lib/Lower/Bridge.cpp b/flang/lib/Lower/Bridge.cpp
index 579f94ba75684..7577c49fbbc16 100644
--- a/flang/lib/Lower/Bridge.cpp
+++ b/flang/lib/Lower/Bridge.cpp
@@ -3115,10 +3115,10 @@ class FirConverter : public Fortran::lower::AbstractConverter {
         hlfir::Entity nullBoxProc(
             fir::factory::createNullBoxProc(*builder, loc, boxTy));
         builder->createStoreWithConvert(loc, nullBoxProc, pptr);
-        return;
+      } else {
+        fir::MutableBoxValue box = genExprMutableBox(loc, *expr);
+        fir::factory::disassociateMutableBox(*builder, loc, box);
       }
-      fir::MutableBoxValue box = genExprMutableBox(loc, *expr);
-      fir::factory::disassociateMutableBox(*builder, loc, box);
     }
   }
 

``````````

</details>


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


More information about the flang-commits mailing list