[flang-commits] [flang] [flang][runtime] Clear leftTabLimit at in FinishReadingRecord (PR #98822)

via flang-commits flang-commits at lists.llvm.org
Sun Jul 14 09:33:08 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

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.

---
Full diff: https://github.com/llvm/llvm-project/pull/98822.diff


1 Files Affected:

- (modified) flang/runtime/unit.cpp (+1) 


``````````diff
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) {

``````````

</details>


https://github.com/llvm/llvm-project/pull/98822


More information about the flang-commits mailing list