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

via flang-commits flang-commits at lists.llvm.org
Mon Nov 6 10:25:52 PST 2023


================
@@ -325,10 +327,16 @@ fir::ExtendedValue Fortran::lower::genCallOpAndResult(
   // compatible interface in Fortran, but that have different signatures in
   // FIR.
   if (funcPointer) {
-    operands.push_back(
-        funcPointer.getType().isa<fir::BoxProcType>()
-            ? builder.create<fir::BoxAddrOp>(loc, funcType, funcPointer)
-            : builder.createConvert(loc, funcType, funcPointer));
+    if (isProcPtr) {
+      funcPointer = builder.create<fir::LoadOp>(loc, funcPointer);
+      auto boxProcTy{fir::BoxProcType::get(builder.getContext(), funcType)};
+      auto func{builder.createConvert(loc, boxProcTy, funcPointer)};
+      operands.push_back(builder.create<fir::BoxAddrOp>(loc, funcType, func));
----------------
jeanPerier wrote:

The convert is correct but not needed, I would still remove it and do as it is done with dummy procedures for consistency (just set the BoxAddrOp result type to be funcType).

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


More information about the flang-commits mailing list