diff --git a/lib/programmemory.cpp b/lib/programmemory.cpp index 6cd0c55de30c..aa98ad3dc37c 100644 --- a/lib/programmemory.cpp +++ b/lib/programmemory.cpp @@ -1577,7 +1577,8 @@ namespace { return execute(expr->astOperand1()); } if (expr->exprId() > 0 && pm->hasValue(expr->exprId())) { - ValueFlow::Value result = pm->at(expr->exprId()); + const ProgramMemory& pm2 = *pm; + ValueFlow::Value result = pm2.at(expr->exprId()); if (result.isImpossible() && result.isIntValue() && result.intvalue == 0 && isUsedAsBool(expr, *settings)) { result.intvalue = !result.intvalue; result.setKnown();