Index: flang/runtime/unit.cpp =================================================================== --- flang/runtime/unit.cpp +++ flang/runtime/unit.cpp @@ -532,6 +532,11 @@ } else { // Unformatted stream: nothing to do } + } else if (handler.GetIoStat() != IostatOk && + furthestPositionInRecord == 0) { + // Error in formatted variable length record, and no output yet; do + // nothing, like most other Fortran compilers do. + return true; } else { // Terminate formatted variable length record const char *lineEnding{"\n"};