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

via flang-commits flang-commits at lists.llvm.org
Fri Nov 10 00:25:05 PST 2023


================
@@ -870,6 +878,22 @@ 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/dummy arguments.
+  // It could have a combination of
+  //     acutal             dummy
+  // 2.  procedure pointer  procedure pointer
+  // 3.  procedure pointer  procedure
+  // 4.  procedure          procedure pointer
+  if (hlfir::isBoxProcAddressType(actual.getType()) ||
+      hlfir::isBoxProcAddressType(dummyType)) {
+    if (actual.getType() != dummyType &&
+        hlfir::isBoxProcAddressType(actual.getType())) {
+      auto baseAddr{actual.getFirBase()};
+      actual = hlfir::Entity{builder.create<fir::LoadOp>(loc, baseAddr)};
+    }
+    return PreparedDummyArgument{actual, /*cleanups=*/{}};
+  }
----------------
jeanPerier wrote:

It is also fine with me if you only deal with passing procedure pointers to procedure pointers in this patch and catch the other cases as a TODO in this patch.

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


More information about the flang-commits mailing list