Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Jan 15, 2024

Conversation

klausler
Copy link
Contributor

…character

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

Fixes #77736.

…character

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

Fixes llvm#77736.
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 11, 2024

@llvm/pr-subscribers-flang-runtime

Author: Peter Klausler (klausler)

Changes

…character

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

Fixes #77736.


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

1 Files Affected:

  • (modified) flang/runtime/io-stmt.cpp (-3)
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())};

Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@klausler klausler merged commit 4fcefbd into llvm:main Jan 15, 2024
6 checks passed
@klausler klausler deleted the bug77736 branch January 15, 2024 20:52
justinfargnoli pushed a commit to justinfargnoli/llvm-project that referenced this pull request Jan 28, 2024
llvm#77835)

…character

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

Fixes llvm#77736.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
flang:runtime flang Flang issues not falling into any other category
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[flang] list-directed WRITE of zero-length CHARACTER fails to print leading blank
3 participants