[flang-commits] [flang] [flang][runtime] Clear leftTabLimit at in FinishReadingRecord (PR #98822)
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Sun Jul 14 09:32:40 PDT 2024
https://github.com/klausler created https://github.com/llvm/llvm-project/pull/98822
ExternalFileUnit::FinishReadingRecord() is called at the end of a READ statement, unless the read is non-advancing and there was no error. In the event of an erroneous non-advancing read, however, FinishReadingRecord() leaves ConnectionState::leftTabLimit inhabited by a value, leaving the impression that the *next* record is undergoing a non-advancing operation, and this cause the next operation to fail. In the test case in the reported bug, the next operation is a BACKSPACE, and it ends up doing nothing. The fix is to always reset leftTabLimit in FinishReadingRecord.
Fixes https://github.com/llvm/llvm-project/issues/98783.
>From f317c757076204af3d36d7d9c8bba6b8990d8cc1 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Sun, 14 Jul 2024 09:23:12 -0700
Subject: [PATCH] [flang][runtime] Clear leftTabLimit at in FinishReadingRecord
ExternalFileUnit::FinishReadingRecord() is called at the end of
a READ statement, unless the read is non-advancing and there was
no error. In the event of an erroneous non-advancing read,
however, FinishReadingRecord() leaves ConnectionState::leftTabLimit
inhabited by a value, leaving the impression that the *next*
record is undergoing a non-advancing operation, and this cause
the next operation to fail. In the test case in the reported
bug, the next operation is a BACKSPACE, and it ends up doing
nothing. The fix is to always reset leftTabLimit in
FinishReadingRecord.
Fixes https://github.com/llvm/llvm-project/issues/98783.
---
flang/runtime/unit.cpp | 1 +
1 file changed, 1 insertion(+)
diff --git a/flang/runtime/unit.cpp b/flang/runtime/unit.cpp
index a11f444d8d754..5c5bca835f3d8 100644
--- a/flang/runtime/unit.cpp
+++ b/flang/runtime/unit.cpp
@@ -268,6 +268,7 @@ void ExternalFileUnit::FinishReadingRecord(IoErrorHandler &handler) {
recordOffsetInFrame_ = 0;
}
BeginRecord();
+ leftTabLimit.reset();
}
bool ExternalFileUnit::AdvanceRecord(IoErrorHandler &handler) {
More information about the flang-commits
mailing list