diff --git a/lib/astutils.cpp b/lib/astutils.cpp index d043adc7aea..f411e2d1572 100644 --- a/lib/astutils.cpp +++ b/lib/astutils.cpp @@ -2639,11 +2639,8 @@ bool isVariableChanged(const Token *tok, int indirect, const Settings *settings, return true; const Token *ftok = tok2; - while (ftok && (!Token::Match(ftok, "[({]") || ftok->isCast())) { - if (ftok->isInitComma()) - return false; + while (ftok && (!Token::Match(ftok, "[({]") || ftok->isCast())) ftok = ftok->astParent(); - } if (ftok && Token::Match(ftok->link(), ")|} !!{")) { const Token * ptok = tok2; @@ -2809,7 +2806,8 @@ Token* findVariableChanged(Token *start, const Token *end, int indirect, const n if (depth < 0) return start; auto getExprTok = memoize([&] { - return findExpression(start, exprid); + auto e = findExpression(start, exprid); + return e ? e : start; }); for (Token *tok = start; tok != end; tok = tok->next()) { if (isExpressionChangedAt(getExprTok, tok, indirect, exprid, globalvar, settings, cpp, depth))