[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


================
@@ -3224,8 +3224,13 @@ class FirConverter : public Fortran::lower::AbstractConverter {
       mlir::Location loc, const Fortran::evaluate::Assignment &assign,
       const Fortran::evaluate::Assignment::BoundsSpec &lbExprs) {
     Fortran::lower::StatementContext stmtCtx;
-    if (Fortran::evaluate::IsProcedure(assign.rhs))
-      TODO(loc, "procedure pointer assignment");
+
+    if (Fortran::evaluate::IsProcedure(assign.rhs)) {
+      auto lhs{fir::getBase(genExprAddr(assign.lhs, stmtCtx, &loc))};
+      auto rhs{fir::getBase(genExprAddr(assign.rhs, stmtCtx, &loc))};
----------------
jeanPerier wrote:

Another point is that you may need custom handling of `Fortran::evaluate::UnwrapExpr<Fortran::evaluate::NullPointer>(assign.rhs)` like it is done for data pointer assignments since `Fortran::evaluate::NullPointer` is untyped and context dependent (I do not think it will be lowered to a fir.boxproc zero initialized).

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


More information about the flang-commits mailing list