[flang-commits] [flang] 17e2f23 - [flang] Fix Boolean flag arguments
peter klausler via flang-commits
flang-commits at lists.llvm.org
Wed Apr 14 10:20:11 PDT 2021
Author: peter klausler
Date: 2021-04-14T10:19:44-07:00
New Revision: 17e2f236f05a8eb73bd66d5f286dccc14d412e74
URL: https://github.com/llvm/llvm-project/commit/17e2f236f05a8eb73bd66d5f286dccc14d412e74
DIFF: https://github.com/llvm/llvm-project/commit/17e2f236f05a8eb73bd66d5f286dccc14d412e74.diff
LOG: [flang] Fix Boolean flag arguments
Two sites in io-api.cpp pass the wrong Boolean flag value to
signify that a new anonymous unit is a formatted file.
Differential Revision: https://reviews.llvm.org/D100419
Added:
Modified:
flang/runtime/buffer.h
flang/runtime/io-api.cpp
Removed:
################################################################################
diff --git a/flang/runtime/buffer.h b/flang/runtime/buffer.h
index c601ee7c4be06..10978240a4fb7 100644
--- a/flang/runtime/buffer.h
+++ b/flang/runtime/buffer.h
@@ -79,7 +79,7 @@ template <typename STORE, std::size_t minBuffer = 65536> class FileFrame {
MakeDataContiguous(handler, bytes);
RUNTIME_CHECK(handler, at == fileOffset_ + frame_);
}
- while (FrameLength() < bytes) {
+ if (FrameLength() < bytes) {
auto next{start_ + length_};
RUNTIME_CHECK(handler, next < size_);
auto minBytes{bytes - FrameLength()};
@@ -88,9 +88,6 @@ template <typename STORE, std::size_t minBuffer = 65536> class FileFrame {
fileOffset_ + length_, buffer_ + next, minBytes, maxBytes, handler)};
length_ += got;
RUNTIME_CHECK(handler, length_ <= size_);
- if (got < minBytes) {
- break; // error or EOF & program can handle it
- }
}
return FrameLength();
}
diff --git a/flang/runtime/io-api.cpp b/flang/runtime/io-api.cpp
index 069e57fdcea36..c9cfb20b07b2a 100644
--- a/flang/runtime/io-api.cpp
+++ b/flang/runtime/io-api.cpp
@@ -310,7 +310,7 @@ Cookie IONAME(BeginEndfile)(
ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
Terminator terminator{sourceFile, sourceLine};
ExternalFileUnit &unit{ExternalFileUnit::LookUpOrCreateAnonymous(
- unitNumber, Direction::Output, true /*formatted*/, terminator)};
+ unitNumber, Direction::Output, false /*formatted*/, terminator)};
return &unit.BeginIoStatement<ExternalMiscIoStatementState>(
unit, ExternalMiscIoStatementState::Endfile, sourceFile, sourceLine);
}
@@ -319,7 +319,7 @@ Cookie IONAME(BeginRewind)(
ExternalUnit unitNumber, const char *sourceFile, int sourceLine) {
Terminator terminator{sourceFile, sourceLine};
ExternalFileUnit &unit{ExternalFileUnit::LookUpOrCreateAnonymous(
- unitNumber, Direction::Input, true /*formatted*/, terminator)};
+ unitNumber, Direction::Input, false /*formatted*/, terminator)};
return &unit.BeginIoStatement<ExternalMiscIoStatementState>(
unit, ExternalMiscIoStatementState::Rewind, sourceFile, sourceLine);
}
More information about the flang-commits
mailing list