Skip to content

Commit 0681f34

Browse files
committed
[flang] Accept proc ptr function result as actual argument without INTENT
A dummy procedure pointer with no INTENT attribute may associate with an actual argument that is the result of a reference to a function that returns a procedure pointer, we think. Fixes #126950.
1 parent 9884803 commit 0681f34

File tree

2 files changed

+3
-5
lines changed

2 files changed

+3
-5
lines changed

flang/lib/Semantics/check-call.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1185,7 +1185,7 @@ static void CheckProcedureArg(evaluate::ActualArgument &arg,
11851185
dummyName);
11861186
}
11871187
} else if (!(dummy.intent == common::Intent::Default &&
1188-
IsNullProcedurePointer(*expr))) {
1188+
IsProcedurePointer(*expr))) {
11891189
// 15.5.2.9(5) -- dummy procedure POINTER
11901190
// Interface compatibility has already been checked above
11911191
messages.Say(

flang/test/Semantics/call09.f90

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@ subroutine test1 ! 15.5.2.9(5)
8787
call s02(p) ! ok
8888
!ERROR: Actual procedure argument has interface incompatible with dummy argument 'p=': function results have distinct types: REAL(4) vs INTEGER(4)
8989
call s02(ip)
90-
!ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
91-
call s02(procptr())
90+
call s02(procptr()) ! believed to be ok
9291
call s02(null()) ! ok
9392
!ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
9493
call s05(null())
@@ -99,8 +98,7 @@ subroutine test1 ! 15.5.2.9(5)
9998
call s02b(p) ! ok
10099
!ERROR: Actual argument function associated with procedure dummy argument 'p=' is not compatible: function results have distinct types: REAL(4) vs INTEGER(4)
101100
call s02b(ip)
102-
!ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
103-
call s02b(procptr())
101+
call s02b(procptr()) ! believed to be ok
104102
call s02b(null())
105103
!ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a pointer unless INTENT(IN)
106104
call s02b(sin)

0 commit comments

Comments
 (0)