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
+14Lines changed: 14 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -3392,6 +3392,20 @@ class TestNullPointer : public TestFixture {
3392
3392
" pointer = func(sizeof pointer[0]);\n"
3393
3393
"}");
3394
3394
ASSERT_EQUALS("", errout_str());
3395
+
3396
+
check("struct T {\n"// #14164
3397
+
" T* next;\n"
3398
+
" char op;\n"
3399
+
"};\n"
3400
+
"void h(int, char);\n"
3401
+
"void g(const T* tok, bool b) {\n"
3402
+
" if (tok->op == '<') {\n"
3403
+
" while ((tok = tok->next) && tok->op != '>') {}\n"
3404
+
" }\n"
3405
+
" h(b ? 1 : 0, tok->op);\n"
3406
+
"}\n");
3407
+
ASSERT_EQUALS("[test.cpp:8:21] -> [test.cpp:10:18]: (warning) Either the condition 'tok=tok->next' is redundant or there is possible null pointer dereference: tok. [nullPointerRedundantCheck]\n",
0 commit comments