#6426 FP duplicateExpressionTernary - (expr) ? ~0u : ~0ul. Regression test added. That issue got fixed in 1.69 already

This commit is contained in:
Alexander Mai 2015-07-26 06:28:23 +02:00
parent afd9f071c0
commit 473336f986
1 changed files with 15 additions and 0 deletions

View File

@ -42,6 +42,7 @@ private:
TEST_CASE(zeroDiv6);
TEST_CASE(zeroDiv7); // #4930
TEST_CASE(zeroDiv8);
TEST_CASE(zeroDiv9);
TEST_CASE(zeroDivCond); // division by zero / useless condition
@ -395,6 +396,20 @@ private:
ASSERT_EQUALS("[test.cpp:4]: (error, inconclusive) Division by zero.\n", errout.str());
}
void zeroDiv9() {
// #6403 FP zerodiv - inside protecting if-clause
check("void foo() {\n"
" double fStepHelp = 0;\n"
" if( (rOuterValue >>= fStepHelp) ) {\n"
" if( fStepHelp != 0.0) {\n"
" double fStepMain = 0;\n"
" sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);\n"
" }\n"
" }\n"
"}");
ASSERT_EQUALS("", errout.str());
}
void zeroDivCond() {
check("void f(unsigned int x) {\n"
" int y = 17 / x;\n"