[flang-commits] [flang] [Flang] Add partial support for lowering procedure pointer assignment. (PR #70461)

Daniel Chen via flang-commits flang-commits at lists.llvm.org
Mon Nov 13 10:33:22 PST 2023


================
@@ -870,9 +874,28 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
   // element if this is an array in an elemental call.
   hlfir::Entity actual = preparedActual.getActual(loc, builder);
 
+  // Handles the procedure pointer actual arguments.
+  if (actual.isProcedurePointer()) {
+    if (hlfir::isBoxProcAddressType(dummyType))
+      // Procedure pointer actual to procedure pointer dummy.
+      return PreparedDummyArgument{actual, /*cleanups=*/{}};
+    if (hlfir::isFortranProcedureValue(dummyType)) {
+      // Procedure pointer actual to procedure dummy.
+      actual = hlfir::derefPointersAndAllocatables(loc, builder, actual);
+      return PreparedDummyArgument{actual, /*cleanups=*/{}};
+    }
+  }
+
   // Do nothing if this is a procedure argument. It is already a
   // fir.boxproc/fir.tuple<fir.boxproc, len> as it should.
   if (actual.isProcedure()) {
+    if (hlfir::isBoxProcAddressType(dummyType)) {
+      // Procedure actual to procedure pointer dummy.
+      auto proc{fir::getBase(actual)};
----------------
DanielCChen wrote:

Accepted. Thanks for the explanation!

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


More information about the flang-commits mailing list