diff --git a/flang-rt/lib/runtime/edit-input.cpp b/flang-rt/lib/runtime/edit-input.cpp index 436fc3894d90..9b31ecce8283 100644 --- a/flang-rt/lib/runtime/edit-input.cpp +++ b/flang-rt/lib/runtime/edit-input.cpp @@ -970,6 +970,11 @@ RT_API_ATTRS bool EditLogicalInput( // not list-directed. char32_t comma{edit.modes.GetSeparatorChar()}; while (next && *next != comma) { + if (*next == '!') { + if (!io.AdvanceRecord()) { // skip namelist comment + return false; + } + } next = io.NextInField(remaining, edit); } }