fix a large number of valgrind warnings in testrunner#2920
fix a large number of valgrind warnings in testrunner#2920danmar merged 1 commit intodanmar:mainfrom IOBYTE:valgrind
Conversation
|
hmm.. it would have been very good to detect this. |
|
I believe we should try to create a small testcase that cppcheck does not warn about.. and create a ticket. |
|
I created https://trac.cppcheck.net/ticket/10009 I do not think it would be possible to write conclusive warnings about such bugs in Cppcheck. I do not know; maybe an inconclusive warning might be ok if there is a "theoretical" execution path in the constructor that does not initialize the member. Otherwise we could in the long run warn about it in the bug hunting analysis. |
|
Since valgrind is able to detect this issue, we could reactivate our valgrind CI check. |
|
Hmm, asan/ubsan did not detect this?? |
asan only detects reads/writes outside of memory, not reading uninitialized memory so that is expected. For uninitialized memory, there is msan (https://clang.llvm.org/docs/MemorySanitizer.html). I've never used it but it seems there may be false positives if not all linked libs are compiled with msan as well, but perhaps it's worth trying to add it to CI? |
==28830== Conditional jump or move depends on uninitialised value(s)
==28830== at 0x10252E4: valueFlowLifetime(TokenList*, SymbolDatabase*, ErrorLogger*, Settings const*)::{lambda(Token const*, Lambda::Capture, std::function<bool (Token const*)>)#2}::operator()(Token const*, Lambda::Capture, std::function<bool (Token const*)>) const (valueflow.cpp:3656)
==28830== by 0x1025A03: valueFlowLifetime(TokenList*, SymbolDatabase*, ErrorLogger*, Settings const*) (valueflow.cpp:3685)
==28830== by 0x1038E94: ValueFlow::setValues(TokenList*, SymbolDatabase*, ErrorLogger*, Settings const*) (valueflow.cpp:6569)
==28830== by 0xF8D155: Tokenizer::simplifyTokens1(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (tokenize.cpp:2384)
==28830== by 0xF8D390: Tokenizer::tokenize(std::istream&, char const*, std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (tokenize.cpp:2401)
==28830== by 0x80918B: TestAssert::check(char const*, char const*) (testassert.cpp:40)
==28830== by 0x809F6D: TestAssert::assignmentInAssert() (testassert.cpp:231)
==28830== by 0x809386: TestAssert::run() (testassert.cpp:50)
==28830== by 0xA99ED7: TestFixture::run(std::__cxx11::basic_string<char, std::char_traits, std::allocator > const&) (testsuite.cpp:309)
==28830== by 0xA9A1FA: TestFixture::runTests(options const&) (testsuite.cpp:332)
==28830== by 0x9EDEC9: main (testrunner.cpp:44)