[flang-commits] [flang] 1fe7a18 - [flang][runtime] Don't emit empty lines for bad writes
Peter Klausler via flang-commits
flang-commits at lists.llvm.org
Fri Apr 15 20:32:40 PDT 2022
Author: Peter Klausler
Date: 2022-04-15T20:32:32-07:00
New Revision: 1fe7a187ae9994dc722e8ccfc9132d88201e8519
URL: https://github.com/llvm/llvm-project/commit/1fe7a187ae9994dc722e8ccfc9132d88201e8519
DIFF: https://github.com/llvm/llvm-project/commit/1fe7a187ae9994dc722e8ccfc9132d88201e8519.diff
LOG: [flang][runtime] Don't emit empty lines for bad writes
When an error occurs in a formatted sequential output statement
and no output was ever emitted, don't emit a blank record.
This matches the error case behavior of other Fortran compilers.
Differential Revision: https://reviews.llvm.org/D123734
Added:
Modified:
flang/runtime/unit.cpp
Removed:
################################################################################
diff --git a/flang/runtime/unit.cpp b/flang/runtime/unit.cpp
index 806e6b16d06b8..e7d0fd5f5959b 100644
--- a/flang/runtime/unit.cpp
+++ b/flang/runtime/unit.cpp
@@ -527,6 +527,11 @@ bool ExternalFileUnit::AdvanceRecord(IoErrorHandler &handler) {
} 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"};
More information about the flang-commits
mailing list