Add regression test for issue 9264: FP nullPointerRedundantCheck - pointer alias (#2133)
This commit is contained in:
parent
3a1aec8850
commit
9ef64eb33e
|
@ -75,6 +75,7 @@ private:
|
||||||
TEST_CASE(nullpointer33);
|
TEST_CASE(nullpointer33);
|
||||||
TEST_CASE(nullpointer34);
|
TEST_CASE(nullpointer34);
|
||||||
TEST_CASE(nullpointer35);
|
TEST_CASE(nullpointer35);
|
||||||
|
TEST_CASE(nullpointer36); // #9264
|
||||||
TEST_CASE(nullpointer_addressOf); // address of
|
TEST_CASE(nullpointer_addressOf); // address of
|
||||||
TEST_CASE(nullpointerSwitch); // #2626
|
TEST_CASE(nullpointerSwitch); // #2626
|
||||||
TEST_CASE(nullpointer_cast); // #4692
|
TEST_CASE(nullpointer_cast); // #4692
|
||||||
|
@ -1427,6 +1428,18 @@ private:
|
||||||
ASSERT_EQUALS("", errout.str());
|
ASSERT_EQUALS("", errout.str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void nullpointer36() {
|
||||||
|
check("char* f(char* s) {\n"
|
||||||
|
" char* start = s;\n"
|
||||||
|
" if (!s)\n"
|
||||||
|
" return (s);\n"
|
||||||
|
" while (isspace(*start))\n"
|
||||||
|
" start++;\n"
|
||||||
|
" return (start);\n"
|
||||||
|
"}\n", true);
|
||||||
|
ASSERT_EQUALS("", errout.str());
|
||||||
|
}
|
||||||
|
|
||||||
void nullpointer_addressOf() { // address of
|
void nullpointer_addressOf() { // address of
|
||||||
check("void f() {\n"
|
check("void f() {\n"
|
||||||
" struct X *x = 0;\n"
|
" struct X *x = 0;\n"
|
||||||
|
|
Loading…
Reference in New Issue