Unit test for #3589
This commit is contained in:
parent
a6ca3cf2cf
commit
825b8b7c66
|
@ -59,6 +59,7 @@ private:
|
|||
TEST_CASE(nullpointer23); // #4665 (false positive)
|
||||
TEST_CASE(nullpointer24); // #5082 fp: chained assignment
|
||||
TEST_CASE(nullpointer25); // #5061
|
||||
TEST_CASE(nullpointer26); // #3589
|
||||
TEST_CASE(nullpointer_cast); // #4692
|
||||
TEST_CASE(nullpointer_castToVoid); // #3771
|
||||
TEST_CASE(pointerCheckAndDeRef); // check if pointer is null and then dereference it
|
||||
|
@ -1292,6 +1293,23 @@ private:
|
|||
ASSERT_EQUALS("[test.cpp:4]: (error) Possible null pointer dereference: array\n", errout.str());
|
||||
}
|
||||
|
||||
void nullpointer26() { // #3589
|
||||
check("double foo() {\n"
|
||||
" sk *t1 = foo();\n"
|
||||
" sk *t2 = foo();\n"
|
||||
" if ((!t1) && (!t2))\n"
|
||||
" return 0.0;\n"
|
||||
" if (t1 && (!t2))\n"
|
||||
" return t1->Inter();\n"
|
||||
" if (t2->GetT() == t)\n"
|
||||
" return t2->Inter();\n"
|
||||
" if (t2 && (!t1))\n"
|
||||
" return 0.0;\n"
|
||||
" return 0;\n"
|
||||
"}");
|
||||
ASSERT_EQUALS("", errout.str());
|
||||
}
|
||||
|
||||
void nullpointer_cast() { // #4692
|
||||
check("char *nasm_skip_spaces(const char *p) {\n"
|
||||
" if (p)\n"
|
||||
|
|
Loading…
Reference in New Issue