Skip to content

Commit 29d8383

Browse files
committed
[flang] Fix call to CHECK() on erroneous subroutine declaration
When processing declarations in resolve-names.cpp, we were returning a symbol that had SubprogramName details to PushSubprogramScope(), which expects a symbol with Subprogram details. I adjusted the code and added a test. Differential Revision: https://reviews.llvm.org/D89829
1 parent 2963145 commit 29d8383

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3048,7 +3048,8 @@ Symbol *SubprogramVisitor::GetSpecificFromGeneric(const parser::Name &name) {
30483048
details->set_specific(Resolve(name, *specific));
30493049
} else if (isGeneric()) {
30503050
SayAlreadyDeclared(name, *specific);
3051-
} else if (!specific->has<SubprogramDetails>()) {
3051+
}
3052+
if (!specific->has<SubprogramDetails>()) {
30523053
specific->set_details(SubprogramDetails{});
30533054
}
30543055
return specific;

flang/test/Semantics/resolve19.f90

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,14 @@ subroutine s(x)
2222
end subroutine
2323
end interface
2424
end module
25+
26+
module m3
27+
interface s
28+
subroutine s
29+
end
30+
end interface
31+
contains
32+
!ERROR: 's' is already declared in this scoping unit
33+
subroutine s
34+
end subroutine
35+
end

0 commit comments

Comments
 (0)