[PATCH] D84282: [flang] Handle leading zeroes after decimal in REAL formatted input

Peter Klausler via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 21 18:04:37 PDT 2020


This revision was automatically updated to reflect the committed changes.
Closed by commit rG9bb091a8fc3c: [flang] Handle leading zeroes after decimal in REAL formatted input (authored by klausler).

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D84282

Files:
  flang/runtime/edit-input.cpp
  flang/unittests/Runtime/hello.cpp


Index: flang/unittests/Runtime/hello.cpp
===================================================================
--- flang/unittests/Runtime/hello.cpp
+++ flang/unittests/Runtime/hello.cpp
@@ -420,11 +420,16 @@
   realInTest("(F18.0)", "                 0", 0x0);
   realInTest("(F18.0)", "                  ", 0x0);
   realInTest("(F18.0)", "                -0", 0x8000000000000000);
+  realInTest("(F18.0)", "                01", 0x3ff0000000000000);
   realInTest("(F18.0)", "                 1", 0x3ff0000000000000);
   realInTest("(F18.0)", "              125.", 0x405f400000000000);
   realInTest("(F18.0)", "              12.5", 0x4029000000000000);
   realInTest("(F18.0)", "              1.25", 0x3ff4000000000000);
+  realInTest("(F18.0)", "             01.25", 0x3ff4000000000000);
   realInTest("(F18.0)", "              .125", 0x3fc0000000000000);
+  realInTest("(F18.0)", "             0.125", 0x3fc0000000000000);
+  realInTest("(F18.0)", "             .0625", 0x3fb0000000000000);
+  realInTest("(F18.0)", "            0.0625", 0x3fb0000000000000);
   realInTest("(F18.0)", "               125", 0x405f400000000000);
   realInTest("(F18.1)", "               125", 0x4029000000000000);
   realInTest("(F18.2)", "               125", 0x3ff4000000000000);
Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -177,8 +177,8 @@
           continue;
         }
       }
-      if (ch == '0' && got == start) {
-        // omit leading zeroes
+      if (ch == '0' && got == start && !decimalPoint) {
+        // omit leading zeroes before the decimal
       } else if (ch >= '0' && ch <= '9') {
         if (got < bufferSize) {
           buffer[got++] = ch;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D84282.279685.patch
Type: text/x-patch
Size: 1784 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200722/7473d6f7/attachment.bin>


More information about the llvm-commits mailing list