Skip to content

Commit 9354045

Browse files
authored
[NFC][flang][runtime] Avoid recursion in EditCharacterOutput and EditLogicalOutput. (#92806)
1 parent 00d7e67 commit 9354045

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

flang/runtime/edit-output.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -832,8 +832,11 @@ RT_API_ATTRS bool EditLogicalOutput(
832832
reinterpret_cast<const unsigned char *>(&truth), sizeof truth);
833833
case 'A': { // legacy extension
834834
int truthBits{truth};
835-
return EditCharacterOutput(
836-
io, edit, reinterpret_cast<char *>(&truthBits), sizeof truthBits);
835+
int len{sizeof truthBits};
836+
int width{edit.width.value_or(len)};
837+
return EmitRepeated(io, ' ', std::max(0, width - len)) &&
838+
EmitEncoded(
839+
io, reinterpret_cast<char *>(&truthBits), std::min(width, len));
837840
}
838841
default:
839842
io.GetIoErrorHandler().SignalError(IostatErrorInFormat,

0 commit comments

Comments
 (0)