From e79a86e45b21cacc57e0cb8bd40d137d8768fc26 Mon Sep 17 00:00:00 2001 From: peter klausler Date: Fri, 17 Jul 2020 11:14:28 -0700 Subject: [PATCH] [flang] Insert leading blanks in LOGICAL formatted output fields Summary: For Lw output editing, emit (w-1) blanks before the T or the F. Reviewed By: sscalpone, PeteSteinfeld Differential Revision: https://reviews.llvm.org/D84059 --- flang/runtime/edit-output.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp index 941c5cc..4680c81 100644 --- a/flang/runtime/edit-output.cpp +++ b/flang/runtime/edit-output.cpp @@ -424,7 +424,8 @@ bool EditLogicalOutput(IoStatementState &io, const DataEdit &edit, bool truth) { switch (edit.descriptor) { case 'L': case 'G': - return io.Emit(truth ? "T" : "F", 1); + return io.EmitRepeated(' ', std::max(0, edit.width.value_or(1) - 1)) && + io.Emit(truth ? "T" : "F", 1); default: io.GetIoErrorHandler().SignalError(IostatErrorInFormat, "Data edit descriptor '%c' may not be used with a LOGICAL data item", -- 2.7.4