-
Notifications
You must be signed in to change notification settings - Fork 12.8k
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 in semantics (#106158)
Semantics crashes when merging a USE-associated derived type with a local generic procedure interface of the same name. (The other direction works.)
- Loading branch information
Showing
2 changed files
with
54 additions
and
2 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,47 @@ | ||
! RUN: %flang_fc1 -fdebug-unparse %s 2>&1 | FileCheck %s | ||
module m1 | ||
type foo | ||
integer n | ||
integer :: m = 1 | ||
end type | ||
end | ||
|
||
module m2 | ||
use m1 | ||
interface foo | ||
module procedure f1 | ||
end interface | ||
contains | ||
type(foo) function f1(a) | ||
real, intent(in) :: a | ||
f1%n = a | ||
f1%m = 2 | ||
end | ||
end | ||
|
||
module m3 | ||
use m2 | ||
interface foo | ||
module procedure f2 | ||
end interface | ||
contains | ||
type(foo) function f2(a) | ||
double precision, intent(in) :: a | ||
f2%n = a | ||
f2%m = 3 | ||
end | ||
end | ||
|
||
program main | ||
use m3 | ||
type(foo) x | ||
!CHECK: foo(n=1_4,m=1_4) | ||
x = foo(1) | ||
print *, x | ||
!CHECK: f1(2._4) | ||
x = foo(2.) | ||
print *, x | ||
!CHECK: f2(3._8) | ||
x = foo(3.d0) | ||
print *, x | ||
end |