[flang] Silence spurious errors from benign USE errors (#106097)

When USE association encounters a conflict that can't be resolved, it
produces a "UseError" symbol that will trigger an error message if that
symbol is ever actually used. UseError symbols that aren't used are
benign.

Ensure that UseError symbols don't run the gamut of declaration
checking. They were getting through, and could lead to spurious error
messages.

Fixes https://github.com/llvm/llvm-project/issues/106020.
This commit is contained in:
Peter Klausler 2024-08-26 10:57:00 -07:00 committed by GitHub
parent 961a138237
commit 7cc789bcfb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 9 additions and 0 deletions

View File

@ -256,6 +256,9 @@ static bool IsBlockData(const Symbol &symbol) {
}
void CheckHelper::Check(const Symbol &symbol) {
if (symbol.has<UseErrorDetails>()) {
return;
}
if (symbol.name().size() > common::maxNameLen &&
&symbol == &symbol.GetUltimate()) {
if (context_.ShouldWarn(common::LanguageFeature::LongNames)) {

View File

@ -34,6 +34,7 @@ module m
real y
common /blk/ y
protected y
logical,protected,external,pointer :: z
contains
@ -60,3 +61,8 @@ contains
end subroutine testProcDecl
end module m
subroutine subb()
!Ensure no spurious error from a benign UseError
use m, testProcDecl=>z
end