[flang-commits] [flang] ea858e3 - [flang][runtime] Accept '\n' as space in internal list-directed input (#107716)
via flang-commits
flang-commits at lists.llvm.org
Tue Sep 10 14:13:51 PDT 2024
Author: Peter Klausler
Date: 2024-09-10T14:13:47-07:00
New Revision: ea858e39bf5b1d09021d142f0c82ef1d4a82d367
URL: https://github.com/llvm/llvm-project/commit/ea858e39bf5b1d09021d142f0c82ef1d4a82d367
DIFF: https://github.com/llvm/llvm-project/commit/ea858e39bf5b1d09021d142f0c82ef1d4a82d367.diff
LOG: [flang][runtime] Accept '\n' as space in internal list-directed input (#107716)
When scanning ahead for the first character in the next input item in
list-directed internal input, allow a newline character to appear and
treat it as a space, matching the behavior of nearly all other Fortran
compilers.
Added:
Modified:
flang/runtime/io-stmt.h
Removed:
################################################################################
diff --git a/flang/runtime/io-stmt.h b/flang/runtime/io-stmt.h
index d67d1ec80afcea..2e0ca46078ecdc 100644
--- a/flang/runtime/io-stmt.h
+++ b/flang/runtime/io-stmt.h
@@ -194,8 +194,9 @@ class IoStatementState {
std::size_t &byteCount) {
auto ch{GetCurrentChar(byteCount)};
bool inNamelist{mutableModes().inNamelist};
- while (!ch || *ch == ' ' || *ch == '\t' || (inNamelist && *ch == '!')) {
- if (ch && (*ch == ' ' || *ch == '\t')) {
+ while (!ch || *ch == ' ' || *ch == '\t' || *ch == '\n' ||
+ (inNamelist && *ch == '!')) {
+ if (ch && (*ch == ' ' || *ch == '\t' || *ch == '\n')) {
HandleRelativePosition(byteCount);
} else if (!AdvanceRecord()) {
return Fortran::common::nullopt;
More information about the flang-commits
mailing list