diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp --- a/flang/lib/Semantics/resolve-names.cpp +++ b/flang/lib/Semantics/resolve-names.cpp @@ -1290,7 +1290,6 @@ ResolveName(*parser::Unwrap(x.name)); } void Post(const parser::ProcComponentRef &); - bool Pre(const parser::ActualArg &); bool Pre(const parser::FunctionReference &); bool Pre(const parser::CallStmt &); bool Pre(const parser::ImportStmt &); @@ -5317,23 +5316,6 @@ // ResolveNamesVisitor implementation -// Ensures that bare undeclared intrinsic procedure names passed as actual -// arguments get recognized as being intrinsics. -bool ResolveNamesVisitor::Pre(const parser::ActualArg &arg) { - if (const auto *expr{std::get_if>(&arg.u)}) { - if (const auto *designator{ - std::get_if>(&expr->value().u)}) { - if (const auto *dataRef{ - std::get_if(&designator->value().u)}) { - if (const auto *name{std::get_if(&dataRef->u)}) { - NameIsKnownOrIntrinsic(*name); - } - } - } - } - return true; -} - bool ResolveNamesVisitor::Pre(const parser::FunctionReference &x) { HandleCall(Symbol::Flag::Function, x.v); return false; diff --git a/flang/test/Semantics/call02.f90 b/flang/test/Semantics/call02.f90 --- a/flang/test/Semantics/call02.f90 +++ b/flang/test/Semantics/call02.f90 @@ -15,6 +15,7 @@ procedure(elem) :: dummy end subroutine end interface + intrinsic :: cos call subr(cos) ! not an error !ERROR: Non-intrinsic ELEMENTAL procedure 'elem' may not be passed as an actual argument call subr(elem) ! C1533 @@ -35,6 +36,7 @@ real, value :: x end function subroutine test + intrinsic :: cos call callme(cos) ! not an error !ERROR: Non-intrinsic ELEMENTAL procedure 'elem01' may not be passed as an actual argument call callme(elem01) ! C1533 @@ -65,3 +67,25 @@ call callee(coarray[1]) ! C1537 end subroutine end module + +program p03 + logical :: l + call s1(index) + l = index .eq. 0 ! index is an object entity, not an intrinsic + call s2(sin) + !ERROR: Actual argument associated with procedure dummy argument 'p=' is not a procedure + call s3(cos) +contains + subroutine s2(x) + real :: x + end + subroutine s3(p) + procedure(real) :: p + end +end + +program p04 + implicit none + !ERROR: No explicit type declared for 'index' + call s1(index) +end 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 @@ -43,6 +43,7 @@ end function subroutine test1 ! 15.5.2.9(5) + intrinsic :: sin procedure(realfunc), pointer :: p procedure(intfunc), pointer :: ip p => realfunc