[all-commits] [llvm/llvm-project] a4ac09: [Flang] Support passing a function that returns pr...

Daniel Chen via All-commits all-commits at lists.llvm.org
Sat Feb 10 08:00:11 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: a4ac099487d057dde8151700b3802eaeb69cead2
      https://github.com/llvm/llvm-project/commit/a4ac099487d057dde8151700b3802eaeb69cead2
  Author: Daniel Chen <cdchen at ca.ibm.com>
  Date:   2024-02-10 (Sat, 10 Feb 2024)

  Changed paths:
    M flang/lib/Lower/ConvertCall.cpp

  Log Message:
  -----------
  [Flang] Support passing a function that returns procedure pointer as actual corresponding to a procedure dummy. (#80891)

Flang crashes with the following case. The problem is we missed the case
when passing a reference to a function that returns a procedure pointer
as actual that corresponds to a procedure dummy. This PR is to fix that.

```
  PROGRAM main
  IMPLICIT NONE
  INTERFACE
    FUNCTION IntF(Arg)
      integer :: Arg, IntF
    END FUNCTION
  END INTERFACE

  INTERFACE
    FUNCTION RetPtr(Arg)
      IMPORT
      PROCEDURE(IntF) :: Arg
      PROCEDURE(IntF), POINTER :: RetPtr
    END FUNCTION
  END INTERFACE

  CALL ModSub(RetPtr(IntF))
  contains
    SUBROUTINE ModSub(Fun1)
    PROCEDURE(IntF) :: Fun1
    END SUBROUTINE
  END
  ```




More information about the All-commits mailing list