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

via flang-commits flang-commits at lists.llvm.org
Tue Nov 7 12:01:37 PST 2023


================
@@ -248,8 +248,12 @@ struct TypeBuilderImpl {
     // links, the fir type is built based on the ultimate symbol. This relies
     // on the fact volatile and asynchronous are not reflected in fir types.
     const Fortran::semantics::Symbol &ultimate = symbol.GetUltimate();
-    if (Fortran::semantics::IsProcedurePointer(ultimate))
-      TODO(loc, "procedure pointers");
+
+    if (Fortran::semantics::IsProcedurePointer(ultimate)) {
+      Fortran::evaluate::ProcedureDesignator proc(ultimate);
+      return Fortran::lower::translateSignature(proc, converter);
----------------
jeanPerier wrote:

Good point. I think the solution for this may just be to add some fir::factory::genNullBoxProc(builder, loc, boxProcType) helper in include/flang/Optimizer/Builder/FIRBuilder.h (similar to fir::factory::createUnallocatedBox for allocatable/pointers) so that this is hidden/centralized.

A solution could also be to allow fir::ZeroOp to operate with a fir.boxproc type (and skip the fir.emboxproc for this case), but you would need to extend [BoxedProcedure.cpp](https://github.com/llvm/llvm-project/blob/main/flang/lib/Optimizer/CodeGen/BoxedProcedure.cpp) pass to rewrite this fir::ZeroOp usage too. But you can still define some genNullBoxProc helper anyway.

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


More information about the flang-commits mailing list