[flang-commits] [flang] d4fd0a7 - [flang] Fix symbol on module subroutine name with same name as generic (#67678)
via flang-commits
flang-commits at lists.llvm.org
Thu Sep 28 09:00:37 PDT 2023
Author: jeanPerier
Date: 2023-09-28T18:00:34+02:00
New Revision: d4fd0a792f602d32261ce85d55a7d8f295ee42a8
URL: https://github.com/llvm/llvm-project/commit/d4fd0a792f602d32261ce85d55a7d8f295ee42a8
DIFF: https://github.com/llvm/llvm-project/commit/d4fd0a792f602d32261ce85d55a7d8f295ee42a8.diff
LOG: [flang] Fix symbol on module subroutine name with same name as generic (#67678)
When a MODULE SUBROUTINE or MODULE FUNCTION is implemented in the same
scope as its interface and appears in a generic with the same name, the
parse::Name of the implementation was not correctly reset and remained
the SubprogramNameDetails symbol after semantics, causing a crash in
lowering that picks up the procedure symbols on the parser names.
Reset the parser::Name symbol before the new symbol is created.
Added:
Modified:
flang/lib/Semantics/resolve-names.cpp
flang/test/Semantics/symbol28.f90
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 22e52521e188362..40f5ab9eb6e27ca 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -4111,6 +4111,7 @@ bool SubprogramVisitor::BeginSubprogram(const parser::Name &name,
if (GenericDetails *
generic{DEREF(FindSymbol(name)).detailsIf<GenericDetails>()}) {
generic->clear_specific();
+ name.symbol = nullptr;
} else {
EraseSymbol(name);
}
diff --git a/flang/test/Semantics/symbol28.f90 b/flang/test/Semantics/symbol28.f90
index ab18749e6bd44b4..2bfe4e3a8c4c293 100644
--- a/flang/test/Semantics/symbol28.f90
+++ b/flang/test/Semantics/symbol28.f90
@@ -14,7 +14,7 @@ module subroutine s2 (j)
end subroutine
end interface
contains
- !DEF: /m1/s MODULE (Subroutine) SubprogramName
+ !DEF: /m1/s MODULE (Subroutine) Subprogram
module subroutine s
end subroutine
!REF: /m1/s2
More information about the flang-commits
mailing list