diff --git a/flang/runtime/edit-input.cpp b/flang/runtime/edit-input.cpp --- a/flang/runtime/edit-input.cpp +++ b/flang/runtime/edit-input.cpp @@ -34,7 +34,7 @@ common::UnsignedInt128 value{0}; for (; next; next = io.NextInField(remaining)) { char32_t ch{*next}; - if (ch == ' ') { + if (ch == ' ' || ch == '\t') { continue; } int digit{0}; @@ -101,7 +101,7 @@ common::UnsignedInt128 value; for (; next; next = io.NextInField(remaining)) { char32_t ch{*next}; - if (ch == ' ') { + if (ch == ' ' || ch == '\t') { if (edit.modes.editingFlags & blankZero) { ch = '0'; // BZ mode - treat blank as if it were zero } else { @@ -170,7 +170,7 @@ } else if (*next == decimal || (*next >= '0' && *next <= '9')) { for (; next; next = io.NextInField(remaining)) { char32_t ch{*next}; - if (ch == ' ') { + if (ch == ' ' || ch == '\t') { if (edit.modes.editingFlags & blankZero) { ch = '0'; // BZ mode - treat blank as if it were zero } else { @@ -229,7 +229,7 @@ return 0; } if (remaining) { - while (next && *next == ' ') { + while (next && (*next == ' ' || *next == '\t')) { next = io.NextInField(remaining); } if (next) { @@ -386,6 +386,7 @@ next = io.NextInField(remaining)) { switch (*next) { case ' ': + case '\t': case ',': case ';': case '/': diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp --- a/flang/runtime/io-stmt.cpp +++ b/flang/runtime/io-stmt.cpp @@ -353,7 +353,7 @@ std::optional &remaining) { while (!remaining || *remaining > 0) { if (auto ch{GetCurrentChar()}) { - if (*ch != ' ') { + if (*ch != ' ' && *ch != '\t') { return ch; } HandleRelativePosition(1); @@ -373,6 +373,7 @@ if (auto next{GetCurrentChar()}) { switch (*next) { case ' ': + case '\t': case ',': case ';': case '/': @@ -415,7 +416,7 @@ std::optional IoStatementState::GetNextNonBlank() { auto ch{GetCurrentChar()}; - while (ch.value_or(' ') == ' ') { + while (!ch || *ch == ' ' || *ch == '\t') { if (ch) { HandleRelativePosition(1); } else if (!AdvanceRecord()) { @@ -485,7 +486,8 @@ if (!imaginaryPart_) { edit.repeat = std::min(remaining_, maxRepeat); auto ch{io.GetNextNonBlank()}; - if (!ch || *ch == ' ' || *ch == comma) { // "r*" repeated null + if (!ch || *ch == ' ' || *ch == '\t' || *ch == comma) { + // "r*" repeated null edit.descriptor = DataEdit::ListDirectedNullValue; } } @@ -554,7 +556,7 @@ edit.descriptor = DataEdit::ListDirectedNullValue; return edit; } - if (!ch || *ch == ' ' || *ch == comma) { // "r*" null + if (!ch || *ch == ' ' || *ch == '\t' || *ch == comma) { // "r*" null edit.descriptor = DataEdit::ListDirectedNullValue; } edit.repeat = std::min(r, maxRepeat);