Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/checkstl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2036,6 +2036,8 @@ static const Token *singleMemberCallInScope(const Token *start, nonneg int varid
if (!Token::findmatch(dotTok->tokAt(2), "%varid%", endStatement, varid))
return nullptr;
input = Token::Match(start->next(), "%var% . %name% ( %varid% )", varid);
if (!dotTok->astOperand1()) // incomplete code
return nullptr;
if (isVariableChanged(dotTok->next(), endStatement, dotTok->astOperand1()->varId(), false, nullptr, true))
return nullptr;
return dotTok;
Expand Down
14 changes: 14 additions & 0 deletions test/teststl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3241,6 +3241,20 @@ class TestStl : public TestFixture {
" void shift() { EffectivityRangeData<int>::iterator it; } \n"
"};\n");
ASSERT_EQUALS("", errout.str());

// test for crash in z3
check("struct explain::imp {\n"
" solver &m_solver;\n"
"\n"
" void project(var x, unsigned num, literal const *ls,\n"
" const scoped_literal_vector &result) {\n"
" DEBUG_CODE(TRACE(\"nlsat\",\n"
" for (literal l\n"
" : result) { m_solver.display(tout << \" \", l); });\n"
" );\n"
" }\n"
"};");
ASSERT_EQUALS("", errout.str());
}

void dereferenceInvalidIterator() {
Expand Down