diff --git a/flang/lib/Semantics/check-call.cpp b/flang/lib/Semantics/check-call.cpp --- a/flang/lib/Semantics/check-call.cpp +++ b/flang/lib/Semantics/check-call.cpp @@ -535,7 +535,8 @@ // 15.5.2.9(1): if dummy is not pure, actual need not be. argInterface.attrs.reset(characteristics::Procedure::Attr::Pure); } - if (interface.HasExplicitInterface()) { + if (interface.HasExplicitInterface() && + argInterface.HasExplicitInterface()) { if (interface != argInterface) { messages.Say( "Actual argument procedure has interface incompatible with %s"_err_en_US, diff --git a/flang/test/Semantics/call09.f90 b/flang/test/Semantics/call09.f90 --- a/flang/test/Semantics/call09.f90 +++ b/flang/test/Semantics/call09.f90 @@ -19,6 +19,9 @@ subroutine s02(p) procedure(realfunc), pointer :: p end subroutine + subroutine s03(p) + procedure(realfunc) :: p + end subroutine subroutine selemental1(p) procedure(cos) :: p ! ok @@ -47,6 +50,9 @@ procedure(realfunc), pointer :: p procedure(intfunc), pointer :: ip integer, pointer :: intPtr + external :: extfunc + external :: extfuncPtr + pointer :: extfuncPtr p => realfunc ip => intfunc call s01(realfunc) ! ok @@ -65,6 +71,7 @@ call s01(null(intPtr)) !ERROR: Actual argument associated with procedure dummy argument 'p=' is not a procedure call s01(B"0101") + call s01(extfunc) ! ok !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) call s02(realfunc) call s02(p) ! ok @@ -78,6 +85,9 @@ call s02(null(p)) !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) call s02(sin) + !ERROR: Actual argument associated with procedure pointer dummy argument 'p=' must be a POINTER unless INTENT(IN) + call s02(extfunc) ! ok + call s03(extfuncPtr) ! ok end subroutine subroutine callsub(s)