C++: Support != constant in range analysis

This commit is contained in:
Jonas Jensen
2020-09-01 15:40:44 +02:00
parent d061b09fe0
commit fbe42fb64c
3 changed files with 76 additions and 27 deletions

View File

@@ -536,33 +536,33 @@
| test.c:541:7:541:7 | n | 0 |
| test.c:542:9:542:9 | n | 1 |
| test.c:545:7:545:7 | n | 0 |
| test.c:546:9:546:9 | n | 0 |
| test.c:546:9:546:9 | n | 1 |
| test.c:548:9:548:9 | n | 0 |
| test.c:551:8:551:8 | n | 0 |
| test.c:552:9:552:9 | n | 0 |
| test.c:554:9:554:9 | n | 0 |
| test.c:557:10:557:10 | n | 0 |
| test.c:558:5:558:5 | n | 0 |
| test.c:558:5:558:5 | n | 1 |
| test.c:561:7:561:7 | n | 0 |
| test.c:565:7:565:7 | n | -32768 |
| test.c:568:7:568:7 | n | 0 |
| test.c:569:9:569:9 | n | 0 |
| test.c:571:9:571:9 | n | 0 |
| test.c:571:9:571:9 | n | 1 |
| test.c:574:7:574:7 | n | 0 |
| test.c:575:9:575:9 | n | 0 |
| test.c:577:9:577:9 | n | 0 |
| test.c:580:10:580:10 | n | -32768 |
| test.c:581:5:581:5 | n | -32768 |
| test.c:580:10:580:10 | n | 0 |
| test.c:581:5:581:5 | n | 1 |
| test.c:584:7:584:7 | n | 0 |
| test.c:588:7:588:7 | n | -32768 |
| test.c:589:9:589:9 | n | -32768 |
| test.c:590:11:590:11 | n | 0 |
| test.c:594:7:594:7 | n | -32768 |
| test.c:595:13:595:13 | n | 5 |
| test.c:598:9:598:9 | n | 5 |
| test.c:598:9:598:9 | n | 6 |
| test.c:601:7:601:7 | n | -32768 |
| test.c:601:22:601:22 | n | -32768 |
| test.c:602:9:602:9 | n | -32768 |
| test.c:601:22:601:22 | n | -32767 |
| test.c:602:9:602:9 | n | -32766 |
| test.cpp:10:7:10:7 | b | -2147483648 |
| test.cpp:11:5:11:5 | x | -2147483648 |
| test.cpp:13:10:13:10 | x | -2147483648 |

View File

@@ -543,7 +543,7 @@ int notequal_type_endpoint(unsigned n) {
}
if (n != 0) {
out(n); // 1 .. [BUG: lower bound is deduced to be 0]
out(n); // 1 ..
} else {
out(n); // 0 .. 0
}
@@ -555,7 +555,7 @@ int notequal_type_endpoint(unsigned n) {
}
while (n != 0) {
n--; // 1 .. [BUG: lower bound is deduced to be 0]
n--; // 1 ..
}
out(n); // 0 .. 0
@@ -568,7 +568,7 @@ void notequal_refinement(short n) {
if (n == 0) {
out(n); // 0 .. 0
} else {
out(n); // 1 .. [BUG: lower bound is deduced to be 0]
out(n); // 1 ..
}
if (n) {
@@ -578,7 +578,7 @@ void notequal_refinement(short n) {
}
while (n != 0) {
n--; // 1 .. [BUG: lower bound is deduced to be -32768]
n--; // 1 ..
}
out(n); // 0 .. 0
@@ -595,10 +595,10 @@ void notequal_variations(short n, float f) {
if (2 * n - 10 == 0) { // Same as `n == 10/2` (modulo overflow)
return;
}
out(n); // 6 .. [BUG: lower bound is deduced to be 5]
out(n); // 6 ..
}
if (n != -32768 && n != -32767) {
out(n); // -32766 .. [BUG: lower bound is deduced to be -32768]
out(n); // -32766 ..
}
}