TestNullPointer: add regression test to cover #8813 (#1699)

... which is fixed since 1.86-72-gbc34f0239
This commit is contained in:
Kamil Dudka 2019-02-26 17:14:45 +01:00 committed by amai2012
parent d7e219043a
commit 21c22d0d4d
1 changed files with 16 additions and 0 deletions

View File

@ -1098,6 +1098,22 @@ private:
"}");
ASSERT_EQUALS("[test.cpp:5] -> [test.cpp:5]: (warning) Either the condition 'p' is redundant or there is possible null pointer dereference: p.\n", errout.str());
}
// ticket #8831 - FP triggered by if/return/else sequence
{
check("void f(int *p, int *q) {\n"
" if (p == NULL)\n"
" return;\n"
" else if (q == NULL)\n"
" return;\n"
" *q = 0;\n"
"}\n"
"\n"
"void g() {\n"
" f(NULL, NULL);\n"
"}", true);
ASSERT_EQUALS("", errout.str());
}
}
// Ticket #2350