[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.
This commit is contained in:
Peter Klausler 2024-09-18 12:20:39 -07:00 committed by GitHub
parent 5f11d38d01
commit 1e19e1e1a4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 15 additions and 0 deletions

View File

@ -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);
}

View File

@ -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