Skip to content

Commit 5ff8fba

Browse files
committed
Merge remote-tracking branch 'refs/remotes/diffblue/master'
2 parents 59b96b6 + d76477d commit 5ff8fba

File tree

102 files changed

+3960
-3014
lines changed

Some content is hidden

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

102 files changed

+3960
-3014
lines changed

.gitattributes

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
*.cpp text
2+
*.c text
3+
*.h text
4+
*.y text
5+
*.tex text
6+
*.shtml text
7+
*.html text
8+
*.css text
9+
Makefile text
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#include <assert.h>
2+
3+
int a[(int)(10./1.)];
4+
int b[(int)2] = { 10, 20 };
5+
int c[(int)(10./1.)] = { 10, 20 };
6+
int d[(int)(10/1)] = { 10, 20 };
7+
8+
int main (void) {
9+
if (a[0]) {
10+
assert(b[1] + c[2] > 20);
11+
}
12+
13+
return 1;
14+
}
15+
16+
extern int g_array[];
17+
int array[(int)(10./1)];
18+
19+
int array2[(int)(10./1)];
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
--
7+
^warning: ignoring
8+
^CONVERSION ERROR$

regression/cbmc/Pointer_array5/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
KNOWNBUG
1+
CORE
22
main.c
33

44
^EXIT=0$

regression/cbmc/Pointer_array6/main.c

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#include <assert.h>
2+
#include <stdlib.h>
3+
4+
extern int nondet_int();
5+
6+
int main() {
7+
8+
int arraylen=nondet_int();
9+
10+
if(arraylen==3)
11+
{
12+
int** array_init = malloc(sizeof(int *)*arraylen);
13+
14+
// mis-align that pointer!
15+
char * char_ptr = (char *) array_init;
16+
char_ptr++;
17+
18+
int local_var;
19+
20+
int **array2=(int**)char_ptr;
21+
22+
// write
23+
array2[0]=&local_var;
24+
25+
// check
26+
int value=*array2[0];
27+
28+
assert(value==local_var);
29+
}
30+
31+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
main.c
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring

regression/cbmc/big-endian-array1/main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ int main()
77
unsigned size;
88
__CPROVER_assume(size==1);
99

10-
array=malloc(size*sizeof(int)); // produce unbounded array
10+
// produce unbounded array that does not have byte granularity
11+
array=malloc(size*sizeof(int));
1112
array[0]=0x01020304;
1213

1314
int array0=array[0];
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
default: tests.log
2+
3+
testalpha:
4+
@../test.pl -c ../unwind-chain.sh -C
5+
6+
testbeta:
7+
@../test.pl -c ../unwind-chain.sh -T
8+
9+
testimpr:
10+
@../test.pl -c ../unwind-chain.sh -K
11+
12+
testnew:
13+
@../test.pl -c ../unwind-chain.sh -F
14+
15+
test:
16+
@../test.pl -c ../unwind-chain.sh
17+
18+
tests.log: ../test.pl
19+
@../test.pl -c ../unwind-chain.sh
20+
21+
clean:
22+
@for dir in *; do \
23+
if [ -d "$$dir" ]; then \
24+
rm $$dir/*.txt $$dir/*.dot $$dir/*.gb $$dir/*.out; \
25+
fi; \
26+
done;
27+
28+
show:
29+
@for dir in *; do \
30+
if [ -d "$$dir" ]; then \
31+
vim -o "$$dir/*.c" "$$dir/*.out"; \
32+
fi; \
33+
done;
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
void f() {}
3+
4+
int main()
5+
{
6+
/**
7+
* This is a test case for the unwind operation of goto-instrument;
8+
* every loop will be unwound K times
9+
**/
10+
const unsigned K=10;
11+
12+
const unsigned n=100;
13+
unsigned c=0, i;
14+
unsigned tres=K/2;;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
c++;
20+
if(i==tres)
21+
break;
22+
}
23+
24+
unsigned eva=n;
25+
if(K<eva) eva=K;
26+
if(tres<eva) eva=tres;
27+
28+
__CPROVER_assert(c==eva, "break a loop unwind (1)");
29+
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
10
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
void f() {}
3+
4+
int main()
5+
{
6+
/**
7+
* This is a test case for the unwind operation of goto-instrument;
8+
* every loop will be unwound K times
9+
**/
10+
const unsigned K=100;
11+
12+
const unsigned n=10;
13+
unsigned c=0, i;
14+
unsigned tres=K/2;;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
c++;
20+
if(i==tres)
21+
break;
22+
}
23+
24+
unsigned eva=n;
25+
if(K<eva) eva=K;
26+
if(tres<eva) eva=tres;
27+
28+
__CPROVER_assert(c==eva, "break a loop unwind (2)");
29+
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
100
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
void f() {}
3+
4+
int main()
5+
{
6+
/**
7+
* This is a test case for the unwind operation of goto-instrument;
8+
* every loop will be unwound K times
9+
**/
10+
const unsigned K=10;
11+
12+
const unsigned n=100;
13+
unsigned c=0, i;
14+
unsigned tres=K/2;;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
if(i>tres)
20+
continue;
21+
c++;
22+
}
23+
24+
unsigned eva=n;
25+
if(K<eva) eva=K;
26+
if(tres<eva) eva=tres;
27+
28+
__CPROVER_assert(c==eva, "continue in a loop unwind (1)");
29+
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
10
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
void f() {}
3+
4+
int main()
5+
{
6+
/**
7+
* This is a test case for the unwind operation of goto-instrument;
8+
* every loop will be unwound K times
9+
**/
10+
const unsigned K=100;
11+
12+
const unsigned n=10;
13+
unsigned c=0, i;
14+
unsigned tres=n/2;;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
if(i>tres)
20+
continue;
21+
c++;
22+
}
23+
24+
unsigned eva=n;
25+
if(K<eva) eva=K;
26+
if(tres<eva) eva=tres;
27+
28+
__CPROVER_assert(c==eva, "continue in a loop unwind (2)");
29+
30+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
100
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
int main()
3+
{
4+
/**
5+
* This is a test case for the unwind operation of goto-instrument;
6+
* every loop will be unwound K times
7+
**/
8+
const unsigned K=10;
9+
10+
const unsigned n=100;
11+
unsigned i=0;
12+
13+
while(++i<n)
14+
{
15+
}
16+
17+
unsigned eva=n;
18+
if(K<eva) eva=K;
19+
20+
__CPROVER_assert(i==eva, "Empty loop unwind (1)");
21+
22+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
10
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
int main()
3+
{
4+
/**
5+
* This is a test case for the unwind operation of goto-instrument;
6+
* every loop will be unwound K times
7+
**/
8+
const unsigned K=100;
9+
10+
const unsigned n=10;
11+
unsigned i=0;
12+
13+
while(++i<n)
14+
{
15+
}
16+
17+
unsigned eva=n;
18+
if(K<eva) eva=K;
19+
20+
__CPROVER_assert(i==eva, "Empty loop unwind (1)");
21+
22+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
100
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
2+
void f() {}
3+
void f2() {}
4+
5+
int main()
6+
{
7+
/**
8+
* This is a test case for the unwind operation of goto-instrument;
9+
* every loop will be unwound K times
10+
**/
11+
const unsigned K=10;
12+
13+
const unsigned n=100;
14+
unsigned c=0, i;
15+
16+
for(i=1; i<=n; i++)
17+
{
18+
f();
19+
c++;
20+
21+
// the nested loop
22+
unsigned j, c2=0;
23+
for(j=1; j<=i; j++)
24+
{
25+
f2();
26+
c2++;
27+
}
28+
unsigned eva2=i;
29+
if(K<eva2) eva2=K;
30+
31+
__CPROVER_assert(c2==eva2, "Nested loops unwind (1): the inner one");
32+
33+
}
34+
35+
unsigned eva=n;
36+
if(K<eva) eva=K;
37+
38+
__CPROVER_assert(c==eva, "Nested loops unwind (1)");
39+
40+
}
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
CORE
2+
main.c
3+
10
4+
^SIGNAL=0$
5+
^VERIFICATION SUCCESSFUL$
6+
--
7+
^warning: ignoring

0 commit comments

Comments
 (0)