Fixed #6446 (FP zerodivcond on double arithmetics)
This commit is contained in:
parent
925f077b8a
commit
6646a896f9
|
@ -1798,7 +1798,7 @@ void CheckOther::checkZeroDivision()
|
|||
continue;
|
||||
}
|
||||
zerodivError(tok,false);
|
||||
} else if (Token::Match(tok, "[/%]") && tok->astOperand2()) {
|
||||
} else if (Token::Match(tok, "[/%]") && tok->astOperand2() && !astIsFloat(tok,false)) {
|
||||
// Value flow..
|
||||
const ValueFlow::Value *value = tok->astOperand2()->getValue(0LL);
|
||||
if (value) {
|
||||
|
|
|
@ -265,11 +265,11 @@ private:
|
|||
}
|
||||
|
||||
|
||||
void zeroDiv1() {
|
||||
void zeroDiv1() { // floating point division by zero => no error
|
||||
check("void foo() {\n"
|
||||
" cout << 1. / 0;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("[test.cpp:2]: (error) Division by zero.\n", errout.str());
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void zeroDiv2() {
|
||||
|
|
Loading…
Reference in New Issue