Skip to content

Commit 2edba5c

Browse files
[flang] Check for BIND(C) name conflicts with alternate entries
Add a check for alternate entries to CheckHelper::CheckGlobalName(). Fixes #62778
1 parent c1ae381 commit 2edba5c

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

flang/lib/Semantics/check-declarations.cpp

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2997,9 +2997,11 @@ void CheckHelper::CheckGlobalName(const Symbol &symbol) {
29972997
// they're not in the same scope.
29982998
} else if ((IsProcedure(symbol) || IsBlockData(symbol)) &&
29992999
(IsProcedure(other) || IsBlockData(other)) &&
3000-
(!IsExternalProcedureDefinition(symbol) ||
3001-
!IsExternalProcedureDefinition(other))) {
3002-
// both are procedures/BLOCK DATA, not both definitions
3000+
(!(IsExternalProcedureDefinition(symbol) || GetMainEntry(&symbol)) ||
3001+
!(IsExternalProcedureDefinition(other) || GetMainEntry(&other)))) {
3002+
// Both are procedures/BLOCK DATA, not both definitions.
3003+
// Note: GetMainEntry() above returns non-null in case symbol
3004+
// is an alternate entry.
30033005
} else if (IsSameSymbolFromHermeticModule(symbol, other)) {
30043006
// Both symbols are the same thing.
30053007
} else if (symbol.has<ModuleDetails>()) {

0 commit comments

Comments
 (0)