llvm-project/flang/test/Semantics/resolve122.f90
Peter Klausler c322e92841
[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.
2024-01-29 14:51:47 -08:00

22 lines
410 B
Fortran

! 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