[flang-commits] [flang] e79a86e - [flang] Insert leading blanks in LOGICAL formatted output fields

peter klausler via flang-commits flang-commits at lists.llvm.org
Sat Jul 18 10:45:03 PDT 2020


Author: peter klausler
Date: 2020-07-18T10:44:16-07:00
New Revision: e79a86e45b21cacc57e0cb8bd40d137d8768fc26

URL: https://github.com/llvm/llvm-project/commit/e79a86e45b21cacc57e0cb8bd40d137d8768fc26
DIFF: https://github.com/llvm/llvm-project/commit/e79a86e45b21cacc57e0cb8bd40d137d8768fc26.diff

LOG: [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

Added: 
    

Modified: 
    flang/runtime/edit-output.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/edit-output.cpp b/flang/runtime/edit-output.cpp
index 941c5ccf3d59..4680c81129ed 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",


        


More information about the flang-commits mailing list