Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions flang/include/flang/Semantics/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,9 @@ inline const DeclTypeSpec *Symbol::GetTypeImpl(int depth) const {
[&](const HostAssocDetails &x) {
return x.symbol().GetTypeImpl(depth);
},
[&](const GenericDetails &x) {
return x.specific() ? x.specific()->GetTypeImpl(depth) : nullptr;
},
[](const auto &) -> const DeclTypeSpec * { return nullptr; },
},
details_);
Expand Down
21 changes: 21 additions & 0 deletions flang/test/Semantics/Inputs/generic-shadows-specific-a.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
! these modules must be read from module files
module m1
interface f ! reference must be to generic
module procedure f ! must have same name as generic interface
end interface
contains
character function f() ! must be character
f = 'q'
end
end
module m2
use m1
end
module m3
use m2 ! must be m2, not m1
contains
subroutine mustExist() ! not called, but must exist
character x
x = f()
end
end
13 changes: 13 additions & 0 deletions flang/test/Semantics/generic-shadows-specific-b.f90
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
! Check that expected code produced with no crash.
subroutine reproducer()
use m2
use m3
character x
x = f()
end

! RUN: %flang_fc1 -fsyntax-only %S/Inputs/generic-shadows-specific-a.f90
! RUN: bbc -emit-fir -o - %s | FileCheck %s

! CHECK-LABEL: func.func @_QPreproducer
! CHECK: fir.call @_QMm1Pf
Loading