[flang-commits] [flang] [Flang] Support NULL(procptr): null intrinsic that has procedure pointer argument. (PR #80072)

Daniel Chen via flang-commits flang-commits at lists.llvm.org
Wed Jan 31 08:22:48 PST 2024


================
@@ -788,9 +788,13 @@ class Fortran::lower::CallInterfaceImpl {
   void handleImplicitResult(
       const Fortran::evaluate::characteristics::FunctionResult &result,
       bool isBindC) {
-    if (result.IsProcedurePointer())
-      TODO(interface.converter.getCurrentLocation(),
-           "procedure pointer result not yet handled");
+    if (auto proc{result.IsProcedurePointer()}) {
----------------
DanielCChen wrote:

Thanks for the review. The following code (reduced from our in-house test bucket) reached to the code. I think it is because intrinsic NULL (MOLD) may be considered to have an implicit interface as its result depends on `MOLD`.
```
  MODULE M
    INTERFACE
      SUBROUTINE IntF()
      END SUBROUTINE
    END INTERFACE

  CONTAINS

    SUBROUTINE ModSub1(ProcPtr)
    PROCEDURE(IntF), POINTER :: ProcPtr
    END SUBROUTINE

  END MODULE


  PROGRAM Arg23
  USE M
  IMPLICIT NONE
  PROCEDURE(IntF), POINTER :: ProcPtr

  CALL ModSub1(NULL(ProcPtr))

  END
  ```

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


More information about the flang-commits mailing list