[flang-commits] [flang] 8b5b38e - [flang] Revert new unintended	runtime behavior
    Peter Klausler via flang-commits 
    flang-commits at lists.llvm.org
       
    Thu Oct 28 14:44:39 PDT 2021
    
    
  
Author: Peter Klausler
Date: 2021-10-28T14:11:06-07:00
New Revision: 8b5b38eb2487d86f9b9854d69a58657192ec2ca4
URL: https://github.com/llvm/llvm-project/commit/8b5b38eb2487d86f9b9854d69a58657192ec2ca4
DIFF: https://github.com/llvm/llvm-project/commit/8b5b38eb2487d86f9b9854d69a58657192ec2ca4.diff
LOG: [flang] Revert new unintended runtime behavior
A recent change caused some variable-length sequential formatted
output statements with record positioning at the end of a FORMAT
(e.g., FORMAT('hi',10X) to append blanks at the end of the completed
record when emitting it.
Differential Revision: https://reviews.llvm.org/D112742
Added: 
    
Modified: 
    flang/runtime/unit.cpp
Removed: 
    
################################################################################
diff  --git a/flang/runtime/unit.cpp b/flang/runtime/unit.cpp
index 6c146e66e32c..575af15513d7 100644
--- a/flang/runtime/unit.cpp
+++ b/flang/runtime/unit.cpp
@@ -455,6 +455,7 @@ bool ExternalFileUnit::AdvanceRecord(IoErrorHandler &handler) {
       furthestPositionInRecord = *recordLength;
     }
     if (!(isFixedRecordLength && access == Access::Direct)) {
+      positionInRecord = furthestPositionInRecord;
       if (isUnformatted.value_or(false)) {
         // Append the length of a sequential unformatted variable-length record
         // as its footer, then overwrite the reserved first four bytes of the
@@ -464,7 +465,6 @@ bool ExternalFileUnit::AdvanceRecord(IoErrorHandler &handler) {
         // headers &/or footers
         std::uint32_t length;
         length = furthestPositionInRecord - sizeof length;
-        positionInRecord = furthestPositionInRecord;
         ok = ok &&
             Emit(reinterpret_cast<const char *>(&length), sizeof length,
                 sizeof length, handler);
        
    
    
More information about the flang-commits
mailing list