[flang-commits] [PATCH] D124279: [flang][runtime] Accept "." as REAL input

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Fri Apr 22 12:38:29 PDT 2022


This revision was automatically updated to reflect the committed changes.
Closed by commit rG839f0abdaaa6: [flang][runtime] Accept "." as REAL input (authored by klausler).

Changed prior to commit:
  https://reviews.llvm.org/D124279?vs=424532&id=424582#toc

Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D124279

Files:
  flang/runtime/edit-input.cpp


Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -186,7 +186,6 @@
       first == 'D' || first == 'Q') {
     Put('.'); // input field is normalized to a fraction
     auto start{got};
-    bool anyDigit{false};
     for (; next; next = io.NextInField(remaining, edit)) {
       char32_t ch{*next};
       if (ch == ' ' || ch == '\t') {
@@ -197,10 +196,8 @@
         }
       }
       if (ch == '0' && got == start && !decimalPoint) {
-        anyDigit = true;
         // omit leading zeroes before the decimal
       } else if (ch >= '0' && ch <= '9') {
-        anyDigit = true;
         Put(ch);
       } else if (ch == decimal && !decimalPoint) {
         // the decimal point is *not* copied to the buffer
@@ -210,11 +207,10 @@
       }
     }
     if (got == start) {
-      if (anyDigit) {
-        Put('0'); // emit at least one digit
-      } else {
-        return 0; // no digits, invalid input
-      }
+      // Nothing but zeroes and maybe a decimal point.  F'2018 requires
+      // at least one digit, but F'77 did not, and a bare "." shows up in
+      // the FCVS suite.
+      Put('0'); // emit at least one digit
     }
     if (next &&
         (*next == 'e' || *next == 'E' || *next == 'd' || *next == 'D' ||


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124279.424582.patch
Type: text/x-patch
Size: 1356 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220422/603ff446/attachment.bin>


More information about the flang-commits mailing list