summaryrefslogtreecommitdiffstats
path: root/flang/lib/Evaluate/tools.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'flang/lib/Evaluate/tools.cpp')
-rw-r--r--flang/lib/Evaluate/tools.cpp13
1 files changed, 10 insertions, 3 deletions
diff --git a/flang/lib/Evaluate/tools.cpp b/flang/lib/Evaluate/tools.cpp
index 726d5308eedf..00b9769befe8 100644
--- a/flang/lib/Evaluate/tools.cpp
+++ b/flang/lib/Evaluate/tools.cpp
@@ -971,11 +971,18 @@ std::optional<parser::MessageFixedText> CheckProcCompatibility(bool isCall,
} else if (lhsProcedure->HasExplicitInterface() &&
!rhsProcedure->HasExplicitInterface()) {
// Section 10.2.2.4, paragraph 3 prohibits associating a procedure pointer
- // with an explicit interface with a procedure with an implicit interface
- msg = "Procedure %s with explicit interface may not be associated with"
- " procedure designator '%s' with implicit interface"_err_en_US;
+ // with an explicit interface with a procedure whose characteristics don't
+ // match. That's the case if the target procedure has an implicit
+ // interface. But this case is allowed by several other compilers as long
+ // as the explicit interface can be called via an implicit interface.
+ if (!lhsProcedure->CanBeCalledViaImplicitInterface()) {
+ msg = "Procedure %s with explicit interface that cannot be called via "
+ "an implicit interface cannot be associated with procedure "
+ "designator with an implicit interface"_err_en_US;
+ }
} else if (!lhsProcedure->HasExplicitInterface() &&
rhsProcedure->HasExplicitInterface()) {
+ // OK if the target can be called via an implicit interface
if (!rhsProcedure->CanBeCalledViaImplicitInterface()) {
msg = "Procedure %s with implicit interface may not be associated "
"with procedure designator '%s' with explicit interface that "