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 @@ -5879,7 +5879,10 @@ return; // reported error } CheckImplicitNoneExternal(name.source, *symbol); - if (IsProcedure(*symbol) || symbol->has() || + if (symbol->has() && + symbol->attrs().test(Attr::ABSTRACT)) { + Say(name, "Abstract interface '%s' may not be called"_err_en_US); + } else if (IsProcedure(*symbol) || symbol->has() || symbol->has() || symbol->has()) { // Symbols with DerivedTypeDetails, ObjectEntityDetails and diff --git a/flang/test/Semantics/resolve20.f90 b/flang/test/Semantics/resolve20.f90 --- a/flang/test/Semantics/resolve20.f90 +++ b/flang/test/Semantics/resolve20.f90 @@ -61,7 +61,18 @@ procedure(proc), deferred :: p1 end type t1 + abstract interface + function f() + end function + end interface + contains subroutine bar end subroutine + subroutine test + !ERROR: Abstract interface 'foo' may not be called + call foo() + !ERROR: Abstract interface 'f' may not be called + x = f() + end subroutine end module