[flang-commits] [flang] [Flang] Allow reference of a function that returns a procedure pointer to be an actual argument corresponding to a procedure pointer dummy. (PR #82824)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Feb 23 12:57:36 PST 2024
================
@@ -87,8 +87,7 @@ subroutine test1 ! 15.5.2.9(5)
call s02(p) ! ok
!ERROR: Actual procedure argument has interface incompatible with dummy argument 'p=': function results have distinct types: REAL(4) vs INTEGER(4)
call s02(ip)
- !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
- call s02(procptr())
+ call s02(procptr()) ! ok
----------------
klausler wrote:
The error is appropriate in this case. See F'2023 subclause 15.5.2.10 paragraph 5: "If a dummy argument is a procedure pointer, the corresponding actual argument shall be a procedure pointer, a reference to a function that returns a procedure pointer, a reference to the intrinsic function NULL, or a valid target for the dummy pointer in a pointer assignment statement. If the actual argument is not a pointer, the dummy argument shall have INTENT (IN); if the actual argument is not a dummy argument it becomes pointer associated with the actual argument, otherwise it becomes pointer associated with the ultimate argument of the actual argument."
The actual argument is not a procedure pointer, it is a reference to a function that returns a procedure pointer. So the corresponding dummy argument must have `INTENT(IN)`.
https://github.com/llvm/llvm-project/pull/82824
More information about the flang-commits
mailing list