diff --git a/flang/lib/Semantics/check-declarations.cpp b/flang/lib/Semantics/check-declarations.cpp index de3fa8794caed..734c34276b13b 100644 --- a/flang/lib/Semantics/check-declarations.cpp +++ b/flang/lib/Semantics/check-declarations.cpp @@ -256,6 +256,9 @@ static bool IsBlockData(const Symbol &symbol) { } void CheckHelper::Check(const Symbol &symbol) { + if (symbol.has()) { + return; + } if (symbol.name().size() > common::maxNameLen && &symbol == &symbol.GetUltimate()) { if (context_.ShouldWarn(common::LanguageFeature::LongNames)) { diff --git a/flang/test/Semantics/resolve82.f90 b/flang/test/Semantics/resolve82.f90 index 88339742efdb3..989ce1d837c70 100644 --- a/flang/test/Semantics/resolve82.f90 +++ b/flang/test/Semantics/resolve82.f90 @@ -34,6 +34,7 @@ end function procFunc real y common /blk/ y protected y + logical,protected,external,pointer :: z contains @@ -60,3 +61,8 @@ subroutine testProcDecl(arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11) end subroutine testProcDecl end module m + +subroutine subb() + !Ensure no spurious error from a benign UseError + use m, testProcDecl=>z +end