[flang-rt] Handle NAMELIST logical comments without preceding space (#183202)

If a comment appears immediately after a logical value in a NAMELIST
file, the flang runtime returns IostatGenericError. No error occurs when
a space preceeds the exclamation point. Add code to handle a comment
while parsing logical values.

Co-authored-by: John Otken john.otken@hpe.com
This commit is contained in:
John Otken 2026-03-04 23:44:33 -06:00 committed by GitHub
parent f49871efdc
commit 22bf237e74
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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);
}
}