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 @@ -6194,7 +6194,11 @@ // TODO: what about instantiations in BLOCK? CheckSaveStmts(); CheckCommonBlocks(); - CheckEquivalenceSets(); + if (!inInterfaceBlock()) { + // TODO: warn for the case where the EQUIVALENCE statement is in a + // procedure declaration in an interface block + CheckEquivalenceSets(); + } } // Analyze the bodies of statement functions now that the symbols in this diff --git a/flang/test/Semantics/equivalence01.f90 b/flang/test/Semantics/equivalence01.f90 --- a/flang/test/Semantics/equivalence01.f90 +++ b/flang/test/Semantics/equivalence01.f90 @@ -1,4 +1,4 @@ -! RUN: %S/test_errors.sh %s %t %f18 +!RUN: %S/test_errors.sh %s %t %f18 subroutine s1 integer i, j real r(2) @@ -182,3 +182,18 @@ !ERROR: 'a(3_8)' and 'a(1_8)' cannot have the same first storage unit equivalence(b(2),a(1)) end module + +subroutine s16 + + integer var, dupName + + ! There should be no error message for the following + equivalence (dupName, var) + + interface + subroutine interfaceSub (dupName) + integer dupName + end subroutine interfaceSub + end interface + +end subroutine s16