Skip to content

Commit 497c3da

Browse files
klauslertmsri
authored andcommitted
[flang] Catch untyped entities in interfaces with IMPLICIT NONE (llvm#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 llvm#108975.
1 parent c5b529d commit 497c3da

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)