Skip to content

Commit fc9a080

Browse files
authored
[flang][runtime] Handle empty NAMELIST value list (#151770)
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 56051da commit fc9a080

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
@@ -578,12 +578,14 @@ bool IODEF(InputNamelist)(Cookie cookie, const NamelistGroup &group) {
578578
addendum && addendum->derivedType()) {
579579
const NonTbpDefinedIoTable *table{group.nonTbpDefinedIo};
580580
listInput->ResetForNextNamelistItem(/*inNamelistSequence=*/true);
581-
if (!IONAME(InputDerivedType)(cookie, *useDescriptor, table)) {
581+
if (!IONAME(InputDerivedType)(cookie, *useDescriptor, table) &&
582+
handler.InError()) {
582583
return false;
583584
}
584585
} else {
585586
listInput->ResetForNextNamelistItem(useDescriptor->rank() > 0);
586-
if (!descr::DescriptorIO<Direction::Input>(io, *useDescriptor)) {
587+
if (!descr::DescriptorIO<Direction::Input>(io, *useDescriptor) &&
588+
handler.InError()) {
587589
return false;
588590
}
589591
}

0 commit comments

Comments
 (0)