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

peter klausler via flang-commits flang-commits at lists.llvm.org
Mon Oct 4 16:47:26 PDT 2021


Author: peter klausler
Date: 2021-10-04T16:46:42-07:00
New Revision: f63dafebf4e9f5dec6ad58cf238bd4eb71d34698

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

LOG: [flang] runtime: fix formatted real input regression w/ spaces

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.

Differential Revision: https://reviews.llvm.org/D110765

Added: 
    

Modified: 
    flang/runtime/edit-input.cpp

Removed: 
    


################################################################################
diff  --git a/flang/runtime/edit-input.cpp b/flang/runtime/edit-input.cpp
index 139da61418a02..42f15562d6c71 100644
--- a/flang/runtime/edit-input.cpp
+++ b/flang/runtime/edit-input.cpp
@@ -137,7 +137,8 @@ static int ScanRealInput(char *buffer, int bufferSize, IoStatementState &io,
   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;
   }


        


More information about the flang-commits mailing list