[flang-commits] [flang] [flang][runtime] Emit leading space before zero-length list-directed … (PR #77835)

via flang-commits flang-commits at lists.llvm.org
Thu Jan 11 13:19:59 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-flang-runtime

Author: Peter Klausler (klausler)

<details>
<summary>Changes</summary>

…character

Don't omit the leading space in list-directed output before a line comprising only a zero-length character value.

Fixes https://github.com/llvm/llvm-project/issues/77736.

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


1 Files Affected:

- (modified) flang/runtime/io-stmt.cpp (-3) 


``````````diff
diff --git a/flang/runtime/io-stmt.cpp b/flang/runtime/io-stmt.cpp
index 7052a6acf41ce0..3ec01ffba9bf06 100644
--- a/flang/runtime/io-stmt.cpp
+++ b/flang/runtime/io-stmt.cpp
@@ -698,9 +698,6 @@ void FormattedIoStatementState<Direction::Input>::GotChar(int n) {
 
 bool ListDirectedStatementState<Direction::Output>::EmitLeadingSpaceOrAdvance(
     IoStatementState &io, std::size_t length, bool isCharacter) {
-  if (length == 0) {
-    return true;
-  }
   const ConnectionState &connection{io.GetConnectionState()};
   int space{connection.positionInRecord == 0 ||
       !(isCharacter && lastWasUndelimitedCharacter())};

``````````

</details>


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


More information about the flang-commits mailing list