Skip to content

Commit 1e19e1e

Browse files
authored
[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 #108975.
1 parent 5f11d38 commit 1e19e1e

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

flang/lib/Semantics/resolve-names.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8748,6 +8748,9 @@ void ResolveNamesVisitor::FinishSpecificationPart(
87488748
CheckImports();
87498749
for (auto &pair : currScope()) {
87508750
auto &symbol{*pair.second};
8751+
if (inInterfaceBlock()) {
8752+
ConvertToObjectEntity(symbol);
8753+
}
87518754
if (NeedsExplicitType(symbol)) {
87528755
ApplyImplicitRules(symbol);
87538756
}

flang/test/Semantics/implicit16.f90

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
! RUN: %python %S/test_errors.py %s %flang_fc1
2+
interface
3+
!ERROR: No explicit type declared for 'a'
4+
subroutine s(a)
5+
implicit none
6+
end
7+
!ERROR: No explicit type declared for 'f'
8+
function f()
9+
implicit none
10+
end
11+
end interface
12+
end

0 commit comments

Comments
 (0)