Fix 10544: FP knownConditionTrueFalse with loop after check (#3508)
This commit is contained in:
parent
6b9ef1fc58
commit
f1f86db0da
|
@ -5384,7 +5384,6 @@ static void valueFlowInferCondition(TokenList* tokenlist,
|
|||
ValueFlow::Value value = result.front();
|
||||
value.intvalue = 1;
|
||||
value.bound = ValueFlow::Value::Bound::Point;
|
||||
value.setKnown();
|
||||
setTokenValue(tok, value, settings);
|
||||
} else if (Token::Match(tok, "%comp%|-") && tok->astOperand1() && tok->astOperand2()) {
|
||||
std::vector<ValueFlow::Value> result =
|
||||
|
|
|
@ -4046,6 +4046,15 @@ private:
|
|||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("[test.cpp:2] -> [test.cpp:3]: (style) Condition 'u1!=u2' is always true\n", errout.str());
|
||||
|
||||
// #10544
|
||||
check("void f(int N) {\n"
|
||||
" if (N > 0) {\n"
|
||||
" while (N)\n"
|
||||
" N = test();\n"
|
||||
" }\n"
|
||||
"}\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void alwaysTrueContainer() {
|
||||
|
|
Loading…
Reference in New Issue