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
{{ message }}
Repository navigation
Commit 6c5d17b
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: test/testcondition.cpp
+13-1Lines changed: 13 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -6026,7 +6026,19 @@ class TestCondition : public TestFixture {
6026
6026
" if (ptr + 1 != 0);\n"
6027
6027
"}");
6028
6028
ASSERT_EQUALS("[test.cpp:2:15]: (warning) Comparison is wrong. Result of 'ptr+1' can't be 0 unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerAdditionResultNotNull]\n", errout_str());
6029
-
}
6029
+
6030
+
// #8260
6031
+
check("void f(int *p) {\n"
6032
+
" int * q = p + 1;\n"
6033
+
" if (q != 0);\n"
6034
+
"}");
6035
+
ASSERT_EQUALS("[test.cpp:3:9]: (warning) Comparison is wrong. Result of 'p+1' can't be 0 unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerAdditionResultNotNull]\n", errout_str());
6036
+
check("void f(int *p) {\n"
6037
+
" int * q = p + 1;\n"
6038
+
" if (0 != q);\n"
6039
+
"}");
6040
+
ASSERT_EQUALS("[test.cpp:3:9]: (warning) Comparison is wrong. Result of 'p+1' can't be 0 unless there is pointer overflow, and pointer overflow is undefined behaviour. [pointerAdditionResultNotNull]\n", errout_str());
0 commit comments