[flang-commits] [flang] e2a3880 - [flang] Revert two new interoperability semantic checks (#93112)
via flang-commits
flang-commits at lists.llvm.org
Thu May 23 16:36:23 PDT 2024
Author: Peter Klausler
Date: 2024-05-23T16:36:18-07:00
New Revision: e2a3880d7ffeefb433d686b0eda59a9e34d98e16
URL: https://github.com/llvm/llvm-project/commit/e2a3880d7ffeefb433d686b0eda59a9e34d98e16
DIFF: https://github.com/llvm/llvm-project/commit/e2a3880d7ffeefb433d686b0eda59a9e34d98e16.diff
LOG: [flang] Revert two new interoperability semantic checks (#93112)
Two checks related to BIND(C) vs non-BIND(C) entry points with the same
dummy argument added by https://github.com/llvm/llvm-project/pull/92474
have turned out to be unnecessary. Revert them and adjust the tests.
Added:
Modified:
flang/lib/Semantics/check-declarations.cpp
flang/test/Semantics/bind-c12.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp
index 901b6624a3953..7034902dcc58d 100644
--- a/flang/lib/Semantics/check-declarations.cpp
+++ b/flang/lib/Semantics/check-declarations.cpp
@@ -2962,32 +2962,6 @@ parser::Messages CheckHelper::WhyNotInteroperableDerivedType(
return msgs;
}
-static UnorderedSymbolSet CollectEntryPointsWithDummy(const Symbol &dummy) {
- UnorderedSymbolSet entries;
- const Scope &subpScope{dummy.owner()};
- for (const auto &[_, ref] : subpScope.parent()) {
- const Symbol &x{*ref};
- if (const auto *subp{x.detailsIf<SubprogramDetails>()}) {
- if (x.scope() == &subpScope || subp->entryScope() == &dummy.owner()) {
- if (std::find(subp->dummyArgs().begin(), subp->dummyArgs().end(),
- &dummy) != subp->dummyArgs().end()) {
- entries.insert(x);
- }
- }
- }
- }
- return entries;
-}
-
-static bool AnyNonBindCEntry(const Symbol &dummy) {
- for (const Symbol &subp : CollectEntryPointsWithDummy(dummy)) {
- if (!subp.attrs().test(Attr::BIND_C)) {
- return true;
- }
- }
- return false;
-}
-
parser::Messages CheckHelper::WhyNotInteroperableObject(
const Symbol &symbol, bool isError) {
parser::Messages msgs;
@@ -3048,10 +3022,6 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
}
if (type->IsAssumedType()) { // ok
} else if (IsAssumedLengthCharacter(symbol)) {
- if (AnyNonBindCEntry(symbol)) {
- msgs.Say(symbol.name(),
- "An assumed-length dummy argument must not appear in a non-BIND(C) entry in a subprogram with an entry that must be interoperable"_err_en_US);
- }
} else if (IsAllocatableOrPointer(symbol) &&
type->category() == DeclTypeSpec::Character &&
type->characterTypeSpec().length().isDeferred()) {
@@ -3082,12 +3052,6 @@ parser::Messages CheckHelper::WhyNotInteroperableObject(
msgs.Say(symbol.name(),
"An interoperable procedure with an OPTIONAL dummy argument might not be portable"_port_en_US);
}
- if (symbol.attrs().test(Attr::VALUE)) {
- if (AnyNonBindCEntry(symbol)) {
- msgs.Say(symbol.name(),
- "A VALUE dummy argument must not appear in a non-BIND(C) entry of a subprogram with an entry that must be interoperable"_err_en_US);
- }
- }
if (IsDescriptor(symbol) && IsPointer(symbol) &&
symbol.attrs().test(Attr::CONTIGUOUS)) {
msgs.Say(symbol.name(),
diff --git a/flang/test/Semantics/bind-c12.f90 b/flang/test/Semantics/bind-c12.f90
index 55af8a93b5b5b..01a8d0cdbc3d3 100644
--- a/flang/test/Semantics/bind-c12.f90
+++ b/flang/test/Semantics/bind-c12.f90
@@ -26,8 +26,8 @@ subroutine p(n)
subroutine subr5(p) bind(c)
interface
+ !WARNING: A dummy procedure of an interoperable procedure should be BIND(C)
subroutine p(c)
- !ERROR: An assumed-length dummy argument must not appear in a non-BIND(C) entry in a subprogram with an entry that must be interoperable
character(*), intent(in) :: c
end
end interface
@@ -52,8 +52,8 @@ character(*) function p()
subroutine subr8(p) bind(c)
interface
+ !WARNING: A dummy procedure of an interoperable procedure should be BIND(C)
subroutine p(n)
- !ERROR: A VALUE dummy argument must not appear in a non-BIND(C) entry of a subprogram with an entry that must be interoperable
integer, intent(in), value :: n
end
end interface
More information about the flang-commits
mailing list