Potential use of uninitialized or invalid values (problems identified by cppcheck)
The following issues have been identified by cppcheck
on a macOS build of master. I've filtered out those that look to be spurious or are in 3rd party code).
/Users/craig/Projects/cmake/Source/cmake.cxx:1413:31: error: Uninitialized struct member: save.type [uninitStructMember]
saved.push_back(std::move(save));
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestBuildHandler.cxx:897:53: error: Uninitialized struct member: errorwarning.LineNumber [uninitStructMember]
this->ErrorsAndWarnings.push_back(std::move(errorwarning));
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestBuildHandler.cxx:920:49: error: Uninitialized struct member: errorwarning.LineNumber [uninitStructMember]
this->ErrorsAndWarnings.push_back(std::move(errorwarning));
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:5: error: Using object to temporary. [danglingTemporaryLifetime]
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:429:27: note: Assigned to reference.
for (std::string const& i : cmReverseRange(ChangeLists)) {
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:27: note: Pointer to container is created here.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:34: note: Added to container 'p4_describe'.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:5: note: Using object to temporary.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:34: error: Using pointer to temporary. [danglingTemporaryLifetime]
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:429:27: note: Assigned to reference.
for (std::string const& i : cmReverseRange(ChangeLists)) {
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:27: note: Pointer to container is created here.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:34: note: Using pointer to temporary.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:434:5: error: Using object to temporary. [danglingTemporaryLifetime]
p4_describe.push_back(nullptr);
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:429:27: note: Assigned to reference.
for (std::string const& i : cmReverseRange(ChangeLists)) {
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:27: note: Pointer to container is created here.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:433:34: note: Added to container 'p4_describe'.
p4_describe.push_back(i.c_str());
^
/Users/craig/Projects/cmake/Source/CTest/cmCTestP4.cxx:434:5: note: Using object to temporary.
p4_describe.push_back(nullptr);
^
There's a separate set of cppcheck
warnings reported in #21165 (closed), but those are less trivial than these more long-standing potential issues mentioned above.