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 @@ -2672,8 +2672,8 @@ bool ScopeHandler::CheckDuplicatedAttr( SourceName name, const Symbol &symbol, Attr attr) { - if (attr == Attr::SAVE || attr == Attr::BIND_C) { - // these are checked elsewhere + if (attr == Attr::SAVE) { + // checked elsewhere } else if (symbol.attrs().test(attr)) { // C815 if (symbol.implicitAttrs().test(attr)) { // Implied attribute is now confirmed explicitly diff --git a/flang/test/Semantics/bind-c02.f90 b/flang/test/Semantics/bind-c02.f90 --- a/flang/test/Semantics/bind-c02.f90 +++ b/flang/test/Semantics/bind-c02.f90 @@ -6,10 +6,10 @@ module m interface - subroutine proc() bind(c) + subroutine proc() end end interface - procedure(proc), bind(c) :: pc1 + procedure(proc) :: pc1 !ERROR: Only variable and named common block can be in BIND statement bind(c) :: proc !ERROR: Only variable and named common block can be in BIND statement diff --git a/flang/test/Semantics/declarations03.f90 b/flang/test/Semantics/declarations03.f90 --- a/flang/test/Semantics/declarations03.f90 +++ b/flang/test/Semantics/declarations03.f90 @@ -32,6 +32,7 @@ !ERROR: The entity 's1' has multiple BIND names integer :: s1 bind(c, name="gg") :: s1 + !ERROR: BIND_C attribute was already specified on 's1' bind(c, name="hh") :: s1 !ERROR: Two entities have the same global name 'ii' @@ -41,10 +42,12 @@ !ERROR: The entity 's4' has multiple BIND names integer, bind(c, name="ss1") :: s4 + !ERROR: BIND_C attribute was already specified on 's4' bind(c, name="jj") :: s4 !ERROR: The entity 's5' has multiple BIND names bind(c, name="kk") :: s5 + !ERROR: BIND_C attribute was already specified on 's5' integer, bind(c, name="ss2") :: s5 end