@@ -1062,7 +1062,7 @@ bool isAliasOf(const Token *tok, nonneg int varid, bool* inconclusive)
10621062 return false ;
10631063}
10641064
1065- bool isAliasOf (const Token* tok, const Token* expr, int * indirect)
1065+ bool isAliasOf (const Token* tok, const Token* expr, nonneg int * indirect)
10661066{
10671067 const Token* r = nullptr ;
10681068 if (indirect)
@@ -2906,7 +2906,7 @@ static bool isExpressionChangedAt(const F& getExprTok,
29062906 // TODO: Is global variable really changed by function call?
29072907 return true ;
29082908 }
2909- int i = 1 ;
2909+ nonneg int i = 1 ;
29102910 bool aliased = false ;
29112911 // If we can't find the expression then assume it is an alias
29122912 auto expr = getExprTok ();
@@ -2916,7 +2916,10 @@ static bool isExpressionChangedAt(const F& getExprTok,
29162916 aliased = isAliasOf (tok, expr, &i);
29172917 if (!aliased)
29182918 return false ;
2919- if (isVariableChanged (tok, indirect + i, settings, depth))
2919+ i += indirect;
2920+ if (tok->valueType () && tok->valueType ()->pointer )
2921+ i = std::min (i, tok->valueType ()->pointer );
2922+ if (isVariableChanged (tok, i, settings, depth))
29202923 return true ;
29212924 // TODO: Try to traverse the lambda function
29222925 if (Token::Match (tok, " %var% (" ))
0 commit comments