[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
This commit is contained in:
peter klausler 2021-09-29 10:19:21 -07:00
parent 95f824ad7c
commit f63dafebf4

View File

@ -137,7 +137,8 @@ static int ScanRealInput(char *buffer, int bufferSize, IoStatementState &io,
if (ScanNumericPrefix(io, edit, next, remaining)) { if (ScanNumericPrefix(io, edit, next, remaining)) {
Put('-'); Put('-');
} }
if (!next) { // empty field means zero if (next.value_or(' ') == ' ') { // empty/blank field means zero
remaining.reset();
Put('0'); Put('0');
return got; return got;
} }