[flang] Silence spurious error (#106086)

Don't attempt to give an object a default binding label when it shows up
in a declaration after it has already been given an explicit binding
label in an earlier declaration.

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

View File

@ -1797,6 +1797,9 @@ void AttrsVisitor::SetBindNameOn(Symbol &symbol) {
}
auto last{label->find_last_not_of(" ")};
label = label->substr(first, last - first + 1);
} else if (symbol.GetIsExplicitBindName()) {
// don't try to override explicit binding name with default
return;
} else if (ClassifyProcedure(symbol) == ProcedureDefinitionClass::Internal) {
// BIND(C) does not give an implicit binding label to internal procedures.
return;

View File

@ -50,6 +50,9 @@ module m
!ERROR: BIND_C attribute was already specified on 's5'
integer, bind(c, name="ss2") :: s5
integer, bind(c, name="s6explicit") :: s6
dimension s6(10) ! caused spurious error
end
subroutine common1()