Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang] Fix NULLIFY statement that returns too early for multiple procedure pointer objects. #81164

Merged
merged 1 commit into from
Feb 9, 2024

Conversation

DanielCChen
Copy link
Contributor

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.

@DanielCChen DanielCChen self-assigned this Feb 8, 2024
@llvmbot llvmbot added flang Flang issues not falling into any other category flang:fir-hlfir labels Feb 8, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented Feb 8, 2024

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

Author: Daniel Chen (DanielCChen)

Changes

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 --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);
     }
   }
 

Copy link
Contributor

@jeanPerier jeanPerier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@DanielCChen DanielCChen merged commit b081e9d into llvm:main Feb 9, 2024
7 checks passed
@DanielCChen DanielCChen deleted the daniel_nullify branch February 9, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:fir-hlfir flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants