[flang-commits] [PATCH] D110765: [flang] runtime: fix formatted real input regression w/ spaces

Peter Klausler via Phabricator via flang-commits flang-commits at lists.llvm.org
Wed Sep 29 13:09:15 PDT 2021


klausler created this revision.
klausler added a reviewer: Renaud-K.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.

Blank input fields must be interpreted as zero, including the case of
virutal space characters generated from record padding at the end of
an input record.  This stopped working sometime in the past few months
for real input (not sure when); here's a fix.

This bug was breaking FCVS test fm111.


https://reviews.llvm.org/D110765

Files:
  flang/runtime/edit-input.cpp


Index: flang/runtime/edit-input.cpp
===================================================================
--- flang/runtime/edit-input.cpp
+++ flang/runtime/edit-input.cpp
@@ -137,7 +137,8 @@
   if (ScanNumericPrefix(io, edit, next, remaining)) {
     Put('-');
   }
-  if (!next) { // empty field means zero
+  if (next.value_or(' ') == ' ') { // empty/blank field means zero
+    remaining.reset();
     Put('0');
     return got;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110765.376015.patch
Type: text/x-patch
Size: 436 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210929/76da5a8a/attachment.bin>


More information about the flang-commits mailing list