[flang-commits] [PATCH] D127012: [flang][runtime] Fix bug with extra leading zero in octal output

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Jun 3 17:07:23 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG604016dbe479: [flang][runtime] Fix bug with extra leading zero in octal output (authored by klausler).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127012/new/

https://reviews.llvm.org/D127012

Files:
  flang/runtime/edit-output.cpp


Index: flang/runtime/edit-output.cpp
===================================================================
--- flang/runtime/edit-output.cpp
+++ flang/runtime/edit-output.cpp
@@ -21,7 +21,11 @@
     const unsigned char *data0, std::size_t bytes) {
   int digits{static_cast<int>((bytes * 8) / LOG2_BASE)};
   int get{static_cast<int>(bytes * 8) - digits * LOG2_BASE};
-  get = get ? get : LOG2_BASE;
+  if (get > 0) {
+    ++digits;
+  } else {
+    get = LOG2_BASE;
+  }
   int shift{7};
   int increment{isHostLittleEndian ? -1 : 1};
   const unsigned char *data{data0 + (isHostLittleEndian ? bytes - 1 : 0)};


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D127012.434209.patch
Type: text/x-patch
Size: 610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220604/5a48fc6a/attachment.bin>


More information about the flang-commits mailing list