[flang-commits] [flang] 1e19e1e - [flang] Catch untyped entities in interfaces with IMPLICIT NONE (#109018)
via flang-commits
flang-commits at lists.llvm.org
Wed Sep 18 12:20:42 PDT 2024
Author: Peter Klausler
Date: 2024-09-18T12:20:39-07:00
New Revision: 1e19e1e1a471f648ff63f02114648211666669ca
URL: https://github.com/llvm/llvm-project/commit/1e19e1e1a471f648ff63f02114648211666669ca
DIFF: https://github.com/llvm/llvm-project/commit/1e19e1e1a471f648ff63f02114648211666669ca.diff
LOG: [flang] Catch untyped entities in interfaces with IMPLICIT NONE (#109018)
The order of operations in name resolution wasn't converting named
entities to objects by the time that they were subjected to the implicit
typing rules in the case of interface blocks. This led to entities
remaining untyped without error, leading to a crash in module file
generation.
Fixes https://github.com/llvm/llvm-project/issues/108975.
Added:
flang/test/Semantics/implicit16.f90
Modified:
flang/lib/Semantics/resolve-names.cpp
Removed:
################################################################################
diff --git a/flang/lib/Semantics/resolve-names.cpp b/flang/lib/Semantics/resolve-names.cpp
index 0ff2795cc98477..5414787d85f7f7 100644
--- a/flang/lib/Semantics/resolve-names.cpp
+++ b/flang/lib/Semantics/resolve-names.cpp
@@ -8748,6 +8748,9 @@ void ResolveNamesVisitor::FinishSpecificationPart(
CheckImports();
for (auto &pair : currScope()) {
auto &symbol{*pair.second};
+ if (inInterfaceBlock()) {
+ ConvertToObjectEntity(symbol);
+ }
if (NeedsExplicitType(symbol)) {
ApplyImplicitRules(symbol);
}
diff --git a/flang/test/Semantics/implicit16.f90 b/flang/test/Semantics/implicit16.f90
new file mode 100644
index 00000000000000..4a03e0c15747df
--- /dev/null
+++ b/flang/test/Semantics/implicit16.f90
@@ -0,0 +1,12 @@
+! RUN: %python %S/test_errors.py %s %flang_fc1
+interface
+!ERROR: No explicit type declared for 'a'
+ subroutine s(a)
+ implicit none
+ end
+!ERROR: No explicit type declared for 'f'
+ function f()
+ implicit none
+ end
+end interface
+end
More information about the flang-commits
mailing list