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
@@ -1604,6 +1606,23 @@ class TestCondition : public TestFixture {
1604
1606
"}");
1605
1607
ASSERT_EQUALS("", errout.str());
1606
1608
}
1609
+
1610
+
voidcheckInvalidTestForOverflow() {
1611
+
check("void f(char *p, unsigned int x) {\n"
1612
+
" assert((p + x) < p);\n"
1613
+
"}");
1614
+
ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow '(p+x)<p'. Condition is always false unless there is overflow, and overflow is UB.\n", errout.str());
1615
+
1616
+
check("void f(signed int x) {\n"
1617
+
" assert(x + 100 < x);\n"
1618
+
"}");
1619
+
ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow 'x+100<x'. Condition is always false unless there is overflow, and overflow is UB.\n", errout.str());
1620
+
1621
+
check("void f(signed int x) {\n"// unsigned overflow => dont warn
@@ -6019,23 +6017,6 @@ class TestOther : public TestFixture {
6019
6017
"}");
6020
6018
ASSERT_EQUALS("", errout.str());
6021
6019
}
6022
-
6023
-
voidcheckInvalidTestForOverflow() {
6024
-
check("void f(char *p, unsigned int x) {\n"
6025
-
" assert((p + x) < p);\n"
6026
-
"}");
6027
-
ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow '(p+x)<p'. Condition is always false unless there is overflow, and overflow is UB.\n", errout.str());
6028
-
6029
-
check("void f(signed int x) {\n"
6030
-
" assert(x + 100 < x);\n"
6031
-
"}");
6032
-
ASSERT_EQUALS("[test.cpp:2]: (warning) Invalid test for overflow 'x+100<x'. Condition is always false unless there is overflow, and overflow is UB.\n", errout.str());
6033
-
6034
-
check("void f(signed int x) {\n"// unsigned overflow => dont warn
0 commit comments