#6505 ValueFlow: handle 2 related if in valueFlowSubFunction. Regression test. Bug got fixed before

This commit is contained in:
Alexander Mai 2015-07-31 21:15:43 +02:00
parent 4400f2ac85
commit 0b96b9d984
1 changed files with 17 additions and 0 deletions

View File

@ -92,6 +92,7 @@ private:
TEST_CASE(functioncalllibrary); // use Library to parse function call
TEST_CASE(functioncallDefaultArguments);
TEST_CASE(nullpointer_internal_error); // #5080
TEST_CASE(ticket6505);
}
void check(const char code[], bool inconclusive = false, const char filename[] = "test.cpp") {
@ -2443,6 +2444,22 @@ private:
"}\n");
ASSERT_EQUALS("", errout.str());
}
void ticket6505() {
check("void foo(MythSocket *socket) {\n"
" bool do_write=false;\n"
" if (socket) {\n"
" do_write=something();\n"
" }\n"
" if (do_write) {\n"
" socket->func();\n"
" }\n"
"}\n"
"void bar() {\n"
" foo(0);\n"
"}\n", true, "test.c");
ASSERT_EQUALS("", errout.str());
}
};
REGISTER_TEST(TestNullPointer)