forked from llvm/llvm-project
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[flang] Fix crash when handling benign USE conflict
When the same name is used for distinct derived types in two modules, and at least one of those modules also defines a generic interface of the same name, name resolution crashes when both modules are USE'd into the same scope. The crash is due to some pointers into the symbol table becoming invalid when a symbol is replaced with a UseErrorDetails; set them to null. Also allow for extending a UseErrorDetails in place rather than emitting a spurious error message. Fixes llvm#121718.
- Loading branch information
Showing
2 changed files
with
37 additions
and
0 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,31 @@ | ||
! RUN: %flang_fc1 2>&1 | FileCheck %s --allow-empty | ||
! CHECK-NOT: error | ||
! Regression test simplified from LLVM bug 121718. | ||
! Ensure no crash and no spurious error message. | ||
module m1 | ||
type foo | ||
integer x | ||
end type | ||
contains | ||
subroutine test | ||
print *, foo(123) | ||
end | ||
end | ||
module m2 | ||
interface foo | ||
procedure f | ||
end interface | ||
type foo | ||
real x | ||
end type | ||
contains | ||
complex function f(x) | ||
complex, intent(in) :: x | ||
f = x | ||
end | ||
end | ||
program main | ||
use m1 | ||
use m2 | ||
call test | ||
end |