You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/testnullpointer.cpp
+13Lines changed: 13 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3710,6 +3710,19 @@ class TestNullPointer : public TestFixture {
3710
3710
" i++;\n"
3711
3711
"}\n");
3712
3712
ASSERT_EQUALS("", errout_str());
3713
+
3714
+
check("void f(const int* p) {\n"// #6710
3715
+
" for (int i = *p; i < 5; ++i) {}\n"
3716
+
" if (p) {}\n"
3717
+
"}\n"
3718
+
"struct S { int a; };\n"
3719
+
"void g(const S* s) {\n"
3720
+
" for (int i = s->a; i < 5; ++i) {}\n"
3721
+
" if (s) {}\n"
3722
+
"}\n");
3723
+
ASSERT_EQUALS("[test.cpp:3:9] -> [test.cpp:2:19]: (warning) Either the condition 'p' is redundant or there is possible null pointer dereference: p. [nullPointerRedundantCheck]\n"
3724
+
"[test.cpp:8:9] -> [test.cpp:7:18]: (warning) Either the condition 's' is redundant or there is possible null pointer dereference: s. [nullPointerRedundantCheck]\n",
0 commit comments