Skip to content

Commit 64a3811

Browse files
committed
[flang][runtime] Handle empty NAMELIST value list
InputNamelist() returns early if any value list read in by InputDerivedType() or DescriptorIo<Input>() is empty, since they return false. But an empty value list is okay, and the early return should occur only on error. Fixes #151756.
1 parent 35cabd6 commit 64a3811

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flang-rt/lib/runtime/namelist.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -570,12 +570,14 @@ bool IODEF(InputNamelist)(Cookie cookie, const NamelistGroup &group) {
570570
addendum && addendum->derivedType()) {
571571
const NonTbpDefinedIoTable *table{group.nonTbpDefinedIo};
572572
listInput->ResetForNextNamelistItem(/*inNamelistSequence=*/true);
573-
if (!IONAME(InputDerivedType)(cookie, *useDescriptor, table)) {
573+
if (!IONAME(InputDerivedType)(cookie, *useDescriptor, table) &&
574+
handler.InError()) {
574575
return false;
575576
}
576577
} else {
577578
listInput->ResetForNextNamelistItem(useDescriptor->rank() > 0);
578-
if (!descr::DescriptorIO<Direction::Input>(io, *useDescriptor)) {
579+
if (!descr::DescriptorIO<Direction::Input>(io, *useDescriptor) &&
580+
handler.InError()) {
579581
return false;
580582
}
581583
}

0 commit comments

Comments
 (0)