valueFlowAfterCondition: wrong analysis for floats
This commit is contained in:
parent
ac4e727da7
commit
c77786a745
|
@ -787,9 +787,8 @@ static void valueFlowAfterCondition(TokenList *tokenlist, ErrorLogger *errorLogg
|
||||||
vartok = tok->astOperand2();
|
vartok = tok->astOperand2();
|
||||||
numtok = tok->astOperand1();
|
numtok = tok->astOperand1();
|
||||||
}
|
}
|
||||||
if (!vartok->isName() || !numtok->isNumber())
|
if (!vartok->isName() || !numtok->isNumber() || !MathLib::isInt(numtok->str()))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else if (tok->str() == "!") {
|
} else if (tok->str() == "!") {
|
||||||
vartok = tok->astOperand1();
|
vartok = tok->astOperand1();
|
||||||
numtok = nullptr;
|
numtok = nullptr;
|
||||||
|
|
|
@ -790,6 +790,13 @@ private:
|
||||||
" x);\n"
|
" x);\n"
|
||||||
"}";
|
"}";
|
||||||
ASSERT_EQUALS(true, testValueOfX(code, 3U, 4));
|
ASSERT_EQUALS(true, testValueOfX(code, 3U, 4));
|
||||||
|
|
||||||
|
// TODO: float
|
||||||
|
code = "void f(float x) {\n"
|
||||||
|
" if (x == 0.5) {}\n"
|
||||||
|
" a = x;\n"
|
||||||
|
"}";
|
||||||
|
ASSERT_EQUALS(false, testValueOfX(code, 3U, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
void valueFlowBitAnd() {
|
void valueFlowBitAnd() {
|
||||||
|
|
Loading…
Reference in New Issue