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

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


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

…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.

>From 4852a56bd28e573ac90d8977c26f2d879ccdbf60 Mon Sep 17 00:00:00 2001
From: Peter Klausler <pklausler at nvidia.com>
Date: Thu, 11 Jan 2024 13:13:47 -0800
Subject: [PATCH] [flang][runtime] Emit leading space before zero-length
 list-directed 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.
---
 flang/runtime/io-stmt.cpp | 3 ---
 1 file changed, 3 deletions(-)

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())};



More information about the flang-commits mailing list