[flang-commits] [flang] 29d8383 - [flang] Fix call to CHECK() on erroneous subroutine declaration
Peter Steinfeld via flang-commits
flang-commits at lists.llvm.org
Tue Oct 20 18:12:14 PDT 2020
Author: Peter Steinfeld
Date: 2020-10-20T18:09:15-07:00
New Revision: 29d838310d4521fbd98741267b0a28cee5b56a36
URL: https://github.com/llvm/llvm-project/commit/29d838310d4521fbd98741267b0a28cee5b56a36
DIFF: https://github.com/llvm/llvm-project/commit/29d838310d4521fbd98741267b0a28cee5b56a36.diff
LOG: [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
Added:
Modified:
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/resolve19.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 0bdf871cd485..40ece09d1b8d 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -3048,7 +3048,8 @@ Symbol *SubprogramVisitor::GetSpecificFromGeneric(const parser::Name &name) {
details->set_specific(Resolve(name, *specific));
} else if (isGeneric()) {
SayAlreadyDeclared(name, *specific);
- } else if (!specific->has<SubprogramDetails>()) {
+ }
+ if (!specific->has<SubprogramDetails>()) {
specific->set_details(SubprogramDetails{});
}
return specific;
diff --git a/flang/test/Semantics/resolve19.f90 b/flang/test/Semantics/resolve19.f90
index dd91e414661e..b8fe8e822ed4 100644
--- a/flang/test/Semantics/resolve19.f90
+++ b/flang/test/Semantics/resolve19.f90
@@ -22,3 +22,14 @@ subroutine s(x)
end subroutine
end interface
end module
+
+module m3
+ interface s
+ subroutine s
+ end
+ end interface
+contains
+ !ERROR: 's' is already declared in this scoping unit
+ subroutine s
+ end subroutine
+end
More information about the flang-commits
mailing list