[flang] Handle useless NAMELIST in interface block (#175214)
NAMELIST has no useful purpose in an interface block, but it's allowed. Fix a crash due to our deferred handling of NAMELIST groups in the execution part (which doesn't exist in an interface block). Fixes https://github.com/llvm/llvm-project/issues/175207.
This commit is contained in:
parent
3fe94ab4d6
commit
3874c4541a
2 changed files with 13 additions and 0 deletions
|
|
@ -9876,6 +9876,9 @@ void ResolveNamesVisitor::FinishSpecificationPart(
|
|||
misparsedStmtFuncFound_ = false;
|
||||
funcResultStack().CompleteFunctionResultType();
|
||||
CheckImports();
|
||||
if (inInterfaceBlock()) {
|
||||
FinishNamelists(); // NAMELIST is useless in an interface, but allowed
|
||||
}
|
||||
for (auto &pair : currScope()) {
|
||||
auto &symbol{*pair.second};
|
||||
if (inInterfaceBlock()) {
|
||||
|
|
|
|||
10
flang/test/Semantics/bug175207.f90
Normal file
10
flang/test/Semantics/bug175207.f90
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
!RUN: %python %S/test_errors.py %s %flang_fc1
|
||||
interface
|
||||
subroutine sub(x)
|
||||
real x
|
||||
namelist /useless/x ! ok, but don't crash
|
||||
!ERROR: 'sub' is not a variable
|
||||
namelist /bad/sub
|
||||
end
|
||||
end interface
|
||||
end
|
||||
Loading…
Reference in a new issue