[flang-commits] [flang] 9354045 - [NFC][flang][runtime] Avoid recursion in EditCharacterOutput and EditLogicalOutput. (#92806)
via flang-commits
flang-commits at lists.llvm.org
Mon May 20 16:16:11 PDT 2024
Author: Slava Zakharin
Date: 2024-05-20T16:16:07-07:00
New Revision: 93540455669ab9ad55bd7e24a42a305194a109af
URL: https://github.com/llvm/llvm-project/commit/93540455669ab9ad55bd7e24a42a305194a109af
DIFF: https://github.com/llvm/llvm-project/commit/93540455669ab9ad55bd7e24a42a305194a109af.diff
LOG: [NFC][flang][runtime] Avoid recursion in EditCharacterOutput and EditLogicalOutput. (#92806)
Added:
Modified:
flang/runtime/edit-output.cpp
Removed:
################################################################################
diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index 13ab91fc56ead..6b24c56483185 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,
More information about the flang-commits
mailing list