Skip to content

Commit 01f2f81

Browse files
[flang-rt] Fixed uninitialized class member variable (llvm#127681)
valgrind complained that `OpenStatementState::pathLength_` was used before it was initialized, when a file was opened with `status='scratch'`. The code seems to expect that `pathLengh_` should be initialized to 0, so added default initialization to the declaration.
1 parent 2847e15 commit 01f2f81

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

flang-rt/include/flang-rt/runtime/io-stmt.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -627,7 +627,7 @@ class OpenStatementState : public ExternalIoStatementBase {
627627
Fortran::common::optional<Action> action_;
628628
Convert convert_{Convert::Unknown};
629629
OwningPtr<char> path_;
630-
std::size_t pathLength_;
630+
std::size_t pathLength_{};
631631
Fortran::common::optional<bool> isUnformatted_;
632632
Fortran::common::optional<Access> access_;
633633
};

0 commit comments

Comments
 (0)