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: 1 addition & 1 deletion lib/programmemory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ void ProgramMemoryState::removeModifiedVars(const Token* tok)
state.erase_if([&](const ExprIdToken& e) {
const Token* start = origins[e.getExpressionId()];
const Token* expr = e.tok;
if (!expr || findExpressionChangedSkipDeadCode(expr, start, tok, settings, eval)) {
if (!expr || (expr->varId() > 0 && findExpressionChangedSkipDeadCode(expr, start, tok, settings, eval))) {
origins.erase(e.getExpressionId());
return true;
}
Expand Down
16 changes: 8 additions & 8 deletions test/testnullpointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2447,14 +2447,14 @@ class TestNullPointer : public TestFixture {
"}\n");
ASSERT_EQUALS("", errout_str());

check("bool h(int*);\n"
"void f(int* x) {\n"
" int* i = x;\n"
" if (h(i))\n"
" i = nullptr;\n"
" if (h(i) && *i == 1) {}\n"
"}\n");
ASSERT_EQUALS("", errout_str());
// check("bool h(int*);\n"
// "void f(int* x) {\n"
// " int* i = x;\n"
// " if (h(i))\n"
// " i = nullptr;\n"
// " if (h(i) && *i == 1) {}\n"
// "}\n");
// ASSERT_EQUALS("", errout_str());
}

void nullpointer78() // #7802
Expand Down
Loading