From 0478c49dc79e68b456f775e70da289cc2a415e3c Mon Sep 17 00:00:00 2001 From: Peter Klausler Date: Mon, 28 Jul 2025 09:08:44 -0700 Subject: [PATCH] [flang][runtime] Remove redundant initialization The assignment to mutableModes() in BeginIoStatement() is redundant, since the mutableModes_ data member is initialized by the constructors of the two classes that now have one. Remove the assignment to avoid confusion. Also restores the original OutputStatementState base class name after a recent patch that needlessly changed it to something equivalent but less readable. --- flang-rt/include/flang-rt/runtime/io-stmt.h | 2 +- flang-rt/lib/runtime/unit.h | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/flang-rt/include/flang-rt/runtime/io-stmt.h b/flang-rt/include/flang-rt/runtime/io-stmt.h index 95b2ee7370981..1d680d7d2ffb3 100644 --- a/flang-rt/include/flang-rt/runtime/io-stmt.h +++ b/flang-rt/include/flang-rt/runtime/io-stmt.h @@ -856,7 +856,7 @@ class InquireUnconnectedFileState : public NoUnitIoStatementState { }; class InquireIOLengthState : public NoUnitIoStatementState, - public IoDirectionState { + public OutputStatementState { public: RT_API_ATTRS InquireIOLengthState( const char *sourceFile = nullptr, int sourceLine = 0); diff --git a/flang-rt/lib/runtime/unit.h b/flang-rt/lib/runtime/unit.h index 9aec9b1659576..f266a486bb708 100644 --- a/flang-rt/lib/runtime/unit.h +++ b/flang-rt/lib/runtime/unit.h @@ -161,9 +161,6 @@ class ExternalFileUnit : public ConnectionState, lock_.Take(); #endif A &state{u_.emplace(std::forward(xs)...)}; - if constexpr (!std::is_same_v) { - state.mutableModes() = ConnectionState::modes; - } directAccessRecWasSet_ = false; io_.emplace(state); return *io_;