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

via flang-commits flang-commits at lists.llvm.org
Thu Jul 18 15:35:28 PDT 2024


Author: Peter Klausler
Date: 2024-07-18T15:35:25-07:00
New Revision: 202785708ed0ff11770f8ae8603514d2c9a54bd9

URL: https://github.com/llvm/llvm-project/commit/202785708ed0ff11770f8ae8603514d2c9a54bd9
DIFF: https://github.com/llvm/llvm-project/commit/202785708ed0ff11770f8ae8603514d2c9a54bd9.diff

LOG: [flang][runtime] Clear leftTabLimit at in FinishReadingRecord (#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.

Added: 
    

Modified: 
    flang/runtime/unit.cpp

Removed: 
    


################################################################################
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