Skip to content

Commit b23e00d

Browse files
committed
Prune TOP values in assume_eq
Found and fixed a problem in interval_abstract_value::to_constant(), for case when interval is a valid single value, but the whole thing is also top. This could arise in a merge of, say, [0, 0] and TOP.
1 parent 9cb937d commit b23e00d

File tree

16 files changed

+222
-74
lines changed

16 files changed

+222
-74
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int main()
2+
{
3+
int x = nondet();
4+
5+
if(x == 30)
6+
{
7+
assert(x == 20);
8+
assert(x == 30);
9+
}
10+
else
11+
{
12+
assert(x != 30);
13+
}
14+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-values constants --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line .* assertion x == 20: FAILURE
7+
\[main\.assertion\.2\] line .* assertion x == 30: SUCCESS
8+
\[main\.assertion\.3\] line .* assertion x != 30: UNKNOWN
9+
--
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-values intervals --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line .* assertion x == 20: FAILURE
7+
\[main\.assertion\.2\] line .* assertion x == 30: SUCCESS
8+
\[main\.assertion\.3\] line .* assertion x != 30: UNKNOWN
9+
--
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-values set-of-constants --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line .* assertion x == 20: FAILURE
7+
\[main\.assertion\.2\] line .* assertion x == 30: SUCCESS
8+
\[main\.assertion\.3\] line .* assertion x != 30: UNKNOWN
9+
--
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
int main()
2+
{
3+
int x = 0;
4+
if(nondet())
5+
{
6+
x = 30;
7+
}
8+
9+
if(x == 30)
10+
{
11+
assert(x == 20);
12+
assert(x == 30);
13+
}
14+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-values constants --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line .* assertion x == 20: FAILURE
7+
\[main\.assertion\.2\] line .* assertion x == 30: SUCCESS
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-values intervals --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line .* assertion x == 20: FAILURE
7+
\[main\.assertion\.2\] line .* assertion x == 30: SUCCESS
8+
--
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-values set-of-constants --verify
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
\[main\.assertion\.1\] line .* assertion x == 20: FAILURE
7+
\[main\.assertion\.2\] line .* assertion x == 30: SUCCESS
8+
--
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#include <assert.h>
2+
3+
typedef int (*fptr_t)(int);
4+
5+
int f(int x)
6+
{
7+
return x + 1;
8+
}
9+
int g(int x)
10+
{
11+
return x;
12+
}
13+
14+
int main(void)
15+
{
16+
int nondet_choice;
17+
18+
fptr_t fun2 = f;
19+
if(nondet_choice)
20+
fun2 = g;
21+
22+
fptr_t fun3;
23+
if(nondet_choice)
24+
fun3 = f;
25+
else
26+
fun3 = g;
27+
28+
return 0;
29+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity --vsd-pointers value-set --show
4+
^main::1::fun2 \(\) -> value-set-begin: ptr ->\(f\), ptr ->\(g\) :value-set-end
5+
^main::1::fun3 \(\) -> value-set-begin: ptr ->\(f\), ptr ->\(g\) :value-set-end
6+
^EXIT=0$
7+
^SIGNAL=0$
8+
--

0 commit comments

Comments
 (0)