diff --git a/lib/checkautovariables.cpp b/lib/checkautovariables.cpp index 92c288f4b..64158c400 100644 --- a/lib/checkautovariables.cpp +++ b/lib/checkautovariables.cpp @@ -86,11 +86,10 @@ static bool checkRvalueExpression(const Token * const vartok) if (var == nullptr) return false; - const Token * const next = vartok->next(); - if (Token::Match(vartok->previous(), "& %var% [") && var->isPointer()) return false; + const Token * const next = vartok->next(); // &a.b[0] if (Token::Match(vartok, "%var% . %var% [") && !var->isPointer()) { const Variable *var2 = next->next()->variable(); diff --git a/lib/tokenize.cpp b/lib/tokenize.cpp index 9ca31d75a..a77a9b915 100644 --- a/lib/tokenize.cpp +++ b/lib/tokenize.cpp @@ -8286,11 +8286,11 @@ void Tokenizer::eraseDeadCode(Token *begin, const Token *end) } else if (isgoto && Token::Match(tok, "[{};] do|while|for|BOOST_FOREACH")) { //it's possible that code inside loop is not dead, //because of the possible presence of the label pointed by 'goto' - std::string labelpattern = "[{};] " + begin->previous()->str() + " : ;"; Token *start = tok->tokAt(2); if (start && start->str() == "(") start = start->link()->next(); if (start && start->str() == "{") { + std::string labelpattern = "[{};] " + begin->previous()->str() + " : ;"; bool simplify = true; for (Token *tok2 = start->next(); tok2 != start->link(); tok2 = tok2->next()) { if (Token::Match(tok2, labelpattern.c_str())) {