[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)

via flang-commits flang-commits at lists.llvm.org
Fri Feb 23 12:18:45 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-semantics

Author: Daniel Chen (DanielCChen)

<details>
<summary>Changes</summary>

This PR is to fix Issue #<!-- -->82005. The result of referencing a function that returns a procedure pointer is a procedure pointer, so it shouldn't require the dummy procedure pointer to have the INTENT(IN) attribute.

---
Full diff: https://github.com/llvm/llvm-project/pull/82824.diff


1 Files Affected:

- (modified) flang/test/Semantics/call09.f90 (+2-4) 


``````````diff
diff --git a/flang/test/Semantics/call09.f90 b/flang/test/Semantics/call09.f90
index b8583ba4a49074..2abea42286ca70 100644
--- a/flang/test/Semantics/call09.f90
+++ b/flang/test/Semantics/call09.f90
@@ -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
     call s02(null()) ! ok
     !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
     call s05(null())
@@ -99,8 +98,7 @@ subroutine test1 ! 15.5.2.9(5)
     call s02b(p) ! ok
     !ERROR: Actual argument function associated with procedure dummy argument 'p=' is not compatible: function results have distinct types: REAL(4) vs INTEGER(4)
     call s02b(ip)
-    !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
-    call s02b(procptr())
+    call s02b(procptr()) ! ok
     call s02b(null())
     !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
     call s02b(sin)

``````````

</details>


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


More information about the flang-commits mailing list