Fix 8358: FP: Condition '(number*0)!=0' is always false (#4065)
This commit is contained in:
parent
9fa5c4e201
commit
4e7125554f
|
@ -756,7 +756,8 @@ static void setTokenValue(Token* tok, ValueFlow::Value value, const Settings* se
|
|||
return;
|
||||
|
||||
// known result when a operand is 0.
|
||||
if (Token::Match(parent, "[&*]") && value.isKnown() && value.isIntValue() && value.intvalue==0) {
|
||||
if (Token::Match(parent, "[&*]") && astIsIntegral(parent, true) && value.isKnown() && value.isIntValue() &&
|
||||
value.intvalue == 0) {
|
||||
setTokenValue(parent, value, settings);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -4094,6 +4094,10 @@ private:
|
|||
" unsigned long long u{};\n"
|
||||
"};\n");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
|
||||
// #8358
|
||||
check("void f(double d) { if ((d * 0) != 0) {} }");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void alwaysTrueSymbolic()
|
||||
|
|
Loading…
Reference in New Issue