[flang-commits] [flang] [flang] lower assumed type actual arguments in call statements (PR #75969)

via flang-commits flang-commits at lists.llvm.org
Mon Jan 8 07:38:16 PST 2024


================
@@ -897,7 +897,8 @@ static PreparedDummyArgument preparePresentUserCallActualArgument(
   }
 
   // NULL() actual to procedure pointer dummy
-  if (Fortran::evaluate::IsNullProcedurePointer(expr) &&
+  if (arg.entity->UnwrapExpr() /* TYPE(*) dummy */ &&
----------------
jeanPerier wrote:

I think passing `*expr` to `prepareUserCallActualArgument` with the assumption that expr will not be used there if it is null is dangerous.

Could you instead try to remove the SomeExpr& argument of prepareUserCallActualArgument and preparePresentUserCallActualArgument, and retrieve the the `SomeExpr* expr` from `arg.entity->UnwrapExpr()` here and protect the place where expr is used?

The contiguity test using `expr` below likely needs to be updated to cover that case.

Other uses of expr can be guarded since assumed type actual argument should not go through those code paths

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


More information about the flang-commits mailing list