Skip to content

Commit 7cc789b

Browse files
authored
[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 #106020.
1 parent 961a138 commit 7cc789b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

flang/lib/Semantics/check-declarations.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,9 @@ static bool IsBlockData(const Symbol &symbol) {
256256
}
257257

258258
void CheckHelper::Check(const Symbol &symbol) {
259+
if (symbol.has<UseErrorDetails>()) {
260+
return;
261+
}
259262
if (symbol.name().size() > common::maxNameLen &&
260263
&symbol == &symbol.GetUltimate()) {
261264
if (context_.ShouldWarn(common::LanguageFeature::LongNames)) {

flang/test/Semantics/resolve82.f90

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ end function procFunc
3434
real y
3535
common /blk/ y
3636
protected y
37+
logical,protected,external,pointer :: z
3738

3839
contains
3940

@@ -60,3 +61,8 @@ subroutine testProcDecl(arg4, arg5, arg6, arg7, arg8, arg9, arg10, arg11)
6061
end subroutine testProcDecl
6162

6263
end module m
64+
65+
subroutine subb()
66+
!Ensure no spurious error from a benign UseError
67+
use m, testProcDecl=>z
68+
end

0 commit comments

Comments
 (0)