diff options
Diffstat (limited to 'flang-rt')
| -rw-r--r-- | flang-rt/include/flang-rt/runtime/io-stmt.h | 3 | ||||
| -rw-r--r-- | flang-rt/lib/runtime/edit-output.cpp | 7 | ||||
| -rw-r--r-- | flang-rt/lib/runtime/io-stmt.cpp | 28 |
3 files changed, 19 insertions, 19 deletions
diff --git a/flang-rt/include/flang-rt/runtime/io-stmt.h b/flang-rt/include/flang-rt/runtime/io-stmt.h index f6a81f7cb812..3c6bcfec8d0c 100644 --- a/flang-rt/include/flang-rt/runtime/io-stmt.h +++ b/flang-rt/include/flang-rt/runtime/io-stmt.h @@ -730,8 +730,7 @@ public: RT_API_ATTRS bool AdvanceRecord(int = 1); RT_API_ATTRS int EndIoStatement(); RT_API_ATTRS bool CanAdvance() { - return DIR == Direction::Input && - (canAdvance_ || this->mutableModes().inNamelist); + return canAdvance_ || this->mutableModes().inNamelist; } private: diff --git a/flang-rt/lib/runtime/edit-output.cpp b/flang-rt/lib/runtime/edit-output.cpp index f90b6fb10963..73dba35ff08d 100644 --- a/flang-rt/lib/runtime/edit-output.cpp +++ b/flang-rt/lib/runtime/edit-output.cpp @@ -175,9 +175,10 @@ bool RT_API_ATTRS EditIntegerOutput(IoStatementState &io, const DataEdit &edit, } if (edit.IsListDirected()) { int total{std::max(leadingSpaces, 1) + subTotal}; - if (io.GetConnectionState().NeedAdvance(static_cast<std::size_t>(total)) && - !io.AdvanceRecord()) { - return false; + if (io.GetConnectionState().NeedAdvance(static_cast<std::size_t>(total))) { + if (!io.AdvanceRecord()) { + return false; + } } leadingSpaces = 1; } else if (!edit.width) { diff --git a/flang-rt/lib/runtime/io-stmt.cpp b/flang-rt/lib/runtime/io-stmt.cpp index b958f23cf534..a88fbe605f89 100644 --- a/flang-rt/lib/runtime/io-stmt.cpp +++ b/flang-rt/lib/runtime/io-stmt.cpp @@ -1109,20 +1109,20 @@ ChildListIoStatementState<DIR>::ChildListIoStatementState( ChildIo &child, const char *sourceFile, int sourceLine) : ChildIoStatementState<DIR>{child, sourceFile, sourceLine} { #if !defined(RT_DEVICE_AVOID_RECURSION) - if constexpr (DIR == Direction::Input) { - if (const auto *listInput{child.parent() - .get_if<ListDirectedStatementState<Direction::Input>>()}) { - this->set_eatComma(listInput->eatComma()); - this->namelistGroup_ = listInput->namelistGroup(); - if (auto *childListInput{child.parent() - .get_if<ChildListIoStatementState<Direction::Input>>()}) { - // Child list input whose parent is child list input: can advance - // if the parent can. - this->canAdvance_ = childListInput->CanAdvance(); - } else { - // Child list input of top-level list input: can advance. - this->canAdvance_ = true; - } + if (const auto *listParent{ + child.parent().get_if<ListDirectedStatementState<DIR>>()}) { + if constexpr (DIR == Direction::Input) { + this->set_eatComma(listParent->eatComma()); + this->namelistGroup_ = listParent->namelistGroup(); + } + if (auto *childListParent{ + child.parent().get_if<ChildListIoStatementState<DIR>>()}) { + // Child list I/O whose parent is child list I/O: can advance + // if the parent can. + this->canAdvance_ = childListParent->CanAdvance(); + } else { + // Child list I/O of top-level list I/O: can advance. + this->canAdvance_ = true; } } #else |
