[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


================
@@ -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:

Looking at your patch, I think we would benefit from having a uniform handling of procedure pointer types. Since we are using the fir.boxproc abstraction, I think we should use it everywhere and that it would probably be simpler to return the signature type wrapped in a fir.boxproc here.

That way, you could likely diminish the footprint of procedure pointers a bit by avoiding custom handling for the allocation and in some other places.

Using the "true" type in fir.boxproc for procedure pointers while it was not done for procedure dummies sounds OK to me: procedure pointers usually comes with a PROCEDURE interface while procedure dummies do not in old Fortran.

We will likely update procedure dummies to have better typing at some point anyway.

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


More information about the flang-commits mailing list