Skip to content

Commit b597bad

Browse files
committed
[flang][runtime] Fix bug with NAMELIST in child input
Don't let "hitSlash_" flag in child input propagate back to the parent input statement's state when the child input was NAMELIST and the NAMELIST input has properly consumed the terminal '/' character. (It can get set if NAMELIST item input ran into it.) The current failure to reset that flag is causing list-directed parent input to stop early. Fixes #159127.
1 parent 8ae3aea commit b597bad

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

flang-rt/lib/runtime/namelist.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,12 @@ bool IODEF(InputNamelist)(Cookie cookie, const NamelistGroup &group) {
596596
}
597597
if (next && *next == '/') {
598598
io.HandleRelativePosition(byteCount);
599+
if (auto *listInput{
600+
io.get_if<ListDirectedStatementState<Direction::Input>>()}) {
601+
// Don't let the namelist's terminal '/' mess up a parent I/O's
602+
// list-directed input.
603+
listInput->set_hitSlash(false);
604+
}
599605
} else if (*next && (*next == '&' || *next == '$')) {
600606
// stop at beginning of next group
601607
} else {

0 commit comments

Comments
 (0)