@@ -1063,7 +1063,6 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings& sett
10631063 flipped = true ;
10641064 else if (!std::equal (tokens.cbegin (), tokens.cend (), branches.cbegin (), &isSameToken))
10651065 continue ;
1066- const bool isMin = Token::Match (condTok, " <|<=" ) ^ flipped;
10671066 std::vector<ValueFlow::Value> values;
10681067 for (const Token* tok2 : tokens) {
10691068 if (tok2->hasKnownIntValue ()) {
@@ -1083,6 +1082,7 @@ static void valueFlowImpossibleValues(TokenList& tokenList, const Settings& sett
10831082 });
10841083 }
10851084 }
1085+ const bool isMin = Token::Match (condTok, " <|<=" ) ^ flipped;
10861086 for (ValueFlow::Value& value : values) {
10871087 value.setImpossible ();
10881088 if (isMin) {
@@ -2076,12 +2076,12 @@ struct LifetimeStore {
20762076 for (const ValueFlow::LifetimeToken& lt : ValueFlow::getLifetimeTokens (argtok, settings)) {
20772077 if (!settings.certainty .isEnabled (Certainty::inconclusive) && lt.inconclusive )
20782078 continue ;
2079- ErrorPath er = errorPath;
2080- er.insert (er.end (), lt.errorPath .cbegin (), lt.errorPath .cend ());
20812079 if (!lt.token )
20822080 return false ;
20832081 if (!pred (lt.token ))
20842082 return false ;
2083+ ErrorPath er = errorPath;
2084+ er.insert (er.end (), lt.errorPath .cbegin (), lt.errorPath .cend ());
20852085 er.emplace_back (argtok, message);
20862086
20872087 ValueFlow::Value value;
@@ -3336,7 +3336,6 @@ static void valueFlowConditionExpressions(const TokenList& tokenlist,
33363336 Token* parenTok = tok->next ();
33373337 if (!Token::simpleMatch (parenTok->link (), " ) {" ))
33383338 continue ;
3339- Token* blockTok = parenTok->link ()->tokAt (1 );
33403339 const Token* condTok = parenTok->astOperand2 ();
33413340 if (condTok->exprId () == 0 )
33423341 continue ;
@@ -3347,6 +3346,7 @@ static void valueFlowConditionExpressions(const TokenList& tokenlist,
33473346 const bool isOp = condTok->isComparisonOp () || condTok->tokType () == Token::eLogicalOp;
33483347 const bool is1 = isOp || astIsBool (condTok);
33493348
3349+ Token* blockTok = parenTok->link ()->tokAt (1 );
33503350 Token* startTok = blockTok;
33513351 // Inner condition
33523352 {
@@ -3703,8 +3703,11 @@ static void valueFlowSymbolicInfer(const SymbolDatabase& symboldatabase, const S
37033703 if (astIsFloat (tok->astOperand2 (), false ))
37043704 continue ;
37053705
3706- SymbolicInferModel leftModel{tok->astOperand1 ()};
3707- std::vector<ValueFlow::Value> values = infer (leftModel, tok->str (), 0 , tok->astOperand2 ()->values ());
3706+ std::vector<ValueFlow::Value> values;
3707+ {
3708+ SymbolicInferModel leftModel{tok->astOperand1 ()};
3709+ values = infer (leftModel, tok->str (), 0 , tok->astOperand2 ()->values ());
3710+ }
37083711 if (values.empty ()) {
37093712 SymbolicInferModel rightModel{tok->astOperand2 ()};
37103713 values = infer (rightModel, tok->str (), tok->astOperand1 ()->values (), 0 );
0 commit comments