@@ -1062,7 +1062,7 @@ bool isAliasOf(const Token *tok, nonneg int varid, bool* inconclusive)
1062
1062
return false ;
1063
1063
}
1064
1064
1065
- bool isAliasOf (const Token* tok, const Token* expr, int * indirect)
1065
+ bool isAliasOf (const Token* tok, const Token* expr, nonneg int * indirect)
1066
1066
{
1067
1067
const Token* r = nullptr ;
1068
1068
if (indirect)
@@ -2906,7 +2906,7 @@ static bool isExpressionChangedAt(const F& getExprTok,
2906
2906
// TODO: Is global variable really changed by function call?
2907
2907
return true ;
2908
2908
}
2909
- int i = 1 ;
2909
+ nonneg int i = 1 ;
2910
2910
bool aliased = false ;
2911
2911
// If we can't find the expression then assume it is an alias
2912
2912
auto expr = getExprTok ();
@@ -2916,7 +2916,10 @@ static bool isExpressionChangedAt(const F& getExprTok,
2916
2916
aliased = isAliasOf (tok, expr, &i);
2917
2917
if (!aliased)
2918
2918
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))
2920
2923
return true ;
2921
2924
// TODO: Try to traverse the lambda function
2922
2925
if (Token::Match (tok, " %var% (" ))
0 commit comments