-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Silence bogus USE statement error (#79896)
When there are multiple USE statement for a particular module using renaming, it is necessary to collect a set of all of the original renaming targets before processing any of USE statements that don't have ONLY: clauses. Currently, if there is a name in the module that can't be added to the current scope -- due to a conflict with an internal or module subprogram, or with a previously use-associated name -- the compiler will emit a bogus error message even if that conflicting name appear on a later USE statement of the same module as the target of a renaming. The new regression test case added with this patch provides a motivating example.
- Loading branch information
Showing
2 changed files
with
56 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
! RUN: %flang_fc1 -fsyntax-only -pedantic %s 2>&1 | FileCheck %s --allow-empty | ||
! Regression test for bogus use-association name conflict | ||
! error: Cannot use-associate 's2'; it is already declared in this scope | ||
! CHECK-NOT: error: | ||
module m1 | ||
contains | ||
subroutine s1 | ||
end | ||
subroutine s2 | ||
end | ||
end | ||
|
||
module m2 | ||
use m1, s1a => s1 | ||
use m1, s2a => s2 | ||
contains | ||
subroutine s1 | ||
end | ||
subroutine s2 | ||
end | ||
end |