Skip to content

Commit ac9c634

Browse files
authored
Merge pull request #5472 from martin-cs/refactor/VSD-with-history-2
Variable sensitivity domain
2 parents 309659f + 22f775c commit ac9c634

File tree

342 files changed

+18539
-1162
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

342 files changed

+18539
-1162
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
default: tests.log
3+
4+
test:
5+
@if ! ../test.pl -c ../chain.sh ; then \
6+
../failed-tests-printer.pl ; \
7+
exit 1; \
8+
fi
9+
10+
tests.log:
11+
@if ! ../test.pl -c ../chain.sh ; then \
12+
../failed-tests-printer.pl ; \
13+
exit 1; \
14+
fi
15+
16+
show:
17+
@for dir in *; do \
18+
if [ -d "$$dir" ]; then \
19+
vim -o "$$dir/*.c" "$$dir/*.out"; \
20+
fi; \
21+
done;
22+
23+
clean:
24+
@for dir in *; do \
25+
rm -f tests.log; \
26+
if [ -d "$$dir" ]; then \
27+
cd "$$dir"; \
28+
rm -f *.out *.gb; \
29+
cd ..; \
30+
fi \
31+
done
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
src_dir=../../../src
4+
5+
goto_analyzer=$src_dir/goto-analyzer/goto-analyzer
6+
7+
options=$1
8+
file_name=${2%.c}
9+
10+
echo options: $options
11+
echo file name : $file_name
12+
13+
$goto_analyzer $file_name.c $options --simplify $file_name_simp.out
14+
$goto_analyzer $file_name_simp.out --show-goto-functions
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
extern int arr[];
2+
3+
void main()
4+
{
5+
int index = 0;
6+
int j = arr[index];
7+
}
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
CORE
2+
main.c
3+
"--variable-sensitivity --vsd-arrays"
4+
5+
arr\[0l\]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
int nondet_int(void);
2+
3+
int main(void)
4+
{
5+
int r = nondet_int();
6+
r = r + 1;
7+
if(r == 2)
8+
{
9+
return 1;
10+
}
11+
return 0;
12+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
CORE
2+
main.c
3+
--variable-sensitivity
4+
r == 2
5+
^SIGNAL=0$
6+
^EXIT=6$
7+
--
8+
--
9+
10+
Checks for a bug that occurred while changing the simplifier,
11+
where a variable would be replaced by the RHS of its last assignment,
12+
even if the value of that expression had changed since then;
13+
Most egregiously when the RHS contained the symbol on the LHS (thus leading
14+
to a recursive definition).
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
void main()
2+
{
3+
int arr[4] = {1, 2, 3, 4};
4+
5+
// No simplification
6+
arr[0] = 1;
7+
8+
// Can simplify
9+
int constant = 1;
10+
arr[constant] = 2;
11+
12+
// No simplification
13+
int nondet;
14+
arr[nondet] = 3;
15+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
"--variable-sensitivity --vsd-arrays"
4+
5+
arr\[0l\] =
6+
arr\[1l\] =
7+
arr\[\(signed long int\)nondet\] =
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
void main()
2+
{
3+
int symbol_a;
4+
int symbol_b;
5+
6+
int nondet;
7+
int *nondet_pointer;
8+
if(nondet > 0)
9+
{
10+
nondet_pointer = &symbol_a;
11+
}
12+
else
13+
{
14+
nondet_pointer = &symbol_b;
15+
}
16+
17+
int *arr[] = {&symbol_a, &symbol_b, nondet_pointer};
18+
19+
// Simplify the pointer
20+
*arr[0] = 1;
21+
22+
// Simplify index and the pointer
23+
int constant1 = 1;
24+
*arr[constant1] = 2;
25+
26+
// Simplify the index but not the pointer
27+
int constant2 = 2;
28+
*arr[constant2] = 3;
29+
30+
// No simplification
31+
int nondet_index;
32+
*arr[nondet_index] = 4;
33+
}
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-arrays --vsd-pointers"
4+
5+
symbol_a = 1
6+
symbol_b = 2
7+
\*arr\[2l\] = 3;
8+
\*arr\[\(signed long int\)nondet_index\] = 4;

0 commit comments

Comments
 (0)