aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSlava Zakharin <szakharin@nvidia.com>2024-05-20 16:16:07 -0700
committerGitHub <noreply@github.com>2024-05-20 16:16:07 -0700
commit93540455669ab9ad55bd7e24a42a305194a109af (patch)
tree548f4edaa64fb4ae63947a8f1ab0b976dd869159
parent00d7e67f8352308288db483f03294460a38a3773 (diff)
downloadllvm-93540455669ab9ad55bd7e24a42a305194a109af.zip
llvm-93540455669ab9ad55bd7e24a42a305194a109af.tar.gz
llvm-93540455669ab9ad55bd7e24a42a305194a109af.tar.bz2
[NFC][flang][runtime] Avoid recursion in EditCharacterOutput and EditLogicalOutput. (#92806)
-rw-r--r--flang/runtime/edit-output.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index 13ab91f..6b24c56 100644
--- a/flang/runtime/edit-output.cpp
+++ b/flang/runtime/edit-output.cpp
@@ -832,8 +832,11 @@ RT_API_ATTRS bool EditLogicalOutput(
reinterpret_cast<const unsigned char *>(&truth), sizeof truth);
case 'A': { // legacy extension
int truthBits{truth};
- return EditCharacterOutput(
- io, edit, reinterpret_cast<char *>(&truthBits), sizeof truthBits);
+ int len{sizeof truthBits};
+ int width{edit.width.value_or(len)};
+ return EmitRepeated(io, ' ', std::max(0, width - len)) &&
+ EmitEncoded(
+ io, reinterpret_cast<char *>(&truthBits), std::min(width, len));
}
default:
io.GetIoErrorHandler().SignalError(IostatErrorInFormat,