[flang-commits] [PATCH] D117595: [flang] runtime error on inappropriate OPEN(UNIT=extant, RECL=n)
Peter Klausler via Phabricator via flang-commits
flang-commits at lists.llvm.org
Tue Jan 18 12:24:50 PST 2022
klausler created this revision.
klausler added a reviewer: vdonaldson.
klausler added a project: Flang.
Herald added a subscriber: jdoerfert.
klausler requested review of this revision.
Don't let a program set a fixed RECL= on a connected unit unless
it already had one with the same value.
https://reviews.llvm.org/D117595
Files:
flang/runtime/io-api.cpp
Index: flang/runtime/io-api.cpp
===================================================================
--- flang/runtime/io-api.cpp
+++ flang/runtime/io-api.cpp
@@ -826,13 +826,15 @@
}
if (n <= 0) {
io.GetIoErrorHandler().SignalError("RECL= must be greater than zero");
- }
- if (open->wasExtant() &&
- open->unit().openRecl.value_or(n) != static_cast<std::int64_t>(n)) {
+ return false;
+ } else if (open->wasExtant() &&
+ open->unit().openRecl.value_or(0) != static_cast<std::int64_t>(n)) {
open->SignalError("RECL= may not be changed for an open unit");
+ return false;
+ } else {
+ open->unit().openRecl = n;
+ return true;
}
- open->unit().openRecl = n;
- return true;
}
bool IONAME(SetStatus)(Cookie cookie, const char *keyword, std::size_t length) {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D117595.400947.patch
Type: text/x-patch
Size: 805 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/flang-commits/attachments/20220118/f74928d7/attachment.bin>
More information about the flang-commits
mailing list