[flang-commits] [PATCH] D100419: [flang] Fix Boolean flag arguments
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Apr 13 16:06:41 PDT 2021
klausler created this revision.
klausler added a reviewer: jeanPerier.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.
Two sites in io-api.cpp pass the wrong Boolean flag value to
signify that a new anonymous unit is a formatted file.
https://reviews.llvm.org/D100419
Files:
flang/runtime/buffer.h
flang/runtime/io-api.cpp
Index: flang/runtime/io-api.cpp
===================================================================
--- flang/runtime/io-api.cpp
+++ flang/runtime/io-api.cpp
@@ -310,7 +310,7 @@
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 @@
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);
}
Index: flang/runtime/buffer.h
===================================================================
--- flang/runtime/buffer.h
+++ flang/runtime/buffer.h
@@ -79,7 +79,7 @@
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 @@
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();
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D100419.337280.patch
Type: text/x-patch
Size: 1935 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20210413/8f71f0fd/attachment.bin>
More information about the flang-commits
mailing list