[PATCH] D93872: [flang] Detect call to abstract interface
Tim Keith via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 28 16:42:07 PST 2020
This revision was automatically updated to reflect the committed changes.
Closed by commit rGf782d5ea86f6: [flang] Detect call to abstract interface (authored by tskeith).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D93872/new/
https://reviews.llvm.org/D93872
Files:
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/resolve20.f90
Index: flang/test/Semantics/resolve20.f90
===================================================================
--- flang/test/Semantics/resolve20.f90
+++ 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
Index: flang/lib/Semantics/resolve-names.cpp
===================================================================
--- flang/lib/Semantics/resolve-names.cpp
+++ flang/lib/Semantics/resolve-names.cpp
@@ -5879,7 +5879,10 @@
return; // reported error
}
CheckImplicitNoneExternal(name.source, *symbol);
- if (IsProcedure(*symbol) || symbol->has<DerivedTypeDetails>() ||
+ if (symbol->has<SubprogramDetails>() &&
+ symbol->attrs().test(Attr::ABSTRACT)) {
+ Say(name, "Abstract interface '%s' may not be called"_err_en_US);
+ } else if (IsProcedure(*symbol) || symbol->has<DerivedTypeDetails>() ||
symbol->has<ObjectEntityDetails>() ||
symbol->has<AssocEntityDetails>()) {
// Symbols with DerivedTypeDetails, ObjectEntityDetails and
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D93872.313912.patch
Type: text/x-patch
Size: 1360 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20201229/ec6845bf/attachment.bin>
More information about the llvm-commits
mailing list