C++: Replace GVN with some other libraries.

This commit is contained in:
Geoffrey White
2021-04-08 15:52:41 +01:00
parent 517fd23ca5
commit 3b437fe6cf
3 changed files with 23 additions and 18 deletions

View File

@@ -1,12 +1,6 @@
| test.cpp:6:5:6:13 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:10:8:10:24 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:15:9:15:25 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:32:12:32:20 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:39:12:39:20 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:47:5:47:13 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:55:5:55:13 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:62:5:62:13 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:69:5:69:13 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:75:8:75:16 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:101:6:101:14 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:128:6:128:14 | ... > ... | Unsigned subtraction can never be negative. |
@@ -14,7 +8,6 @@
| test.cpp:146:7:146:15 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:152:7:152:15 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:182:6:182:14 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:195:6:195:14 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:208:6:208:14 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:252:10:252:18 | ... > ... | Unsigned subtraction can never be negative. |
| test.cpp:266:10:266:24 | ... > ... | Unsigned subtraction can never be negative. |

View File

@@ -12,7 +12,7 @@ void test(unsigned x, unsigned y, bool unknown) {
}
if(total <= limit) {
while(limit - total > 0) { // GOOD [FALSE POSITIVE]
while(limit - total > 0) { // GOOD
total += getAnInt();
if(total > limit) break;
}
@@ -29,14 +29,14 @@ void test(unsigned x, unsigned y, bool unknown) {
} else {
y = x;
}
bool b1 = x - y > 0; // GOOD [FALSE POSITIVE]
bool b1 = x - y > 0; // GOOD
x = getAnInt();
y = getAnInt();
if(y > x) {
y = x - 1;
}
bool b2 = x - y > 0; // GOOD [FALSE POSITIVE]
bool b2 = x - y > 0; // GOOD
int N = getAnInt();
y = x;
@@ -44,7 +44,7 @@ void test(unsigned x, unsigned y, bool unknown) {
if(unknown) { y--; }
}
if(x - y > 0) { } // GOOD [FALSE POSITIVE]
if(x - y > 0) { } // GOOD
x = y;
while(cond()) {
@@ -52,7 +52,7 @@ void test(unsigned x, unsigned y, bool unknown) {
y--;
}
if(x - y > 0) { } // GOOD [FALSE POSITIVE]
if(x - y > 0) { } // GOOD
y = 0;
for(int i = 0; i < x; ++i) {
@@ -66,7 +66,7 @@ void test(unsigned x, unsigned y, bool unknown) {
if(unknown) { x++; }
}
if(x - y > 0) { } // GOOD [FALSE POSITIVE]
if(x - y > 0) { } // GOOD
int n = getAnInt();
if (n > x - y) { n = x - y; }
@@ -192,7 +192,7 @@ void test10() {
a = b;
}
if (a - b > 0) { // GOOD (as a >= b) [FALSE POSITIVE]
if (a - b > 0) { // GOOD (as a >= b)
// ...
}
}