Skip to content

Siemens fix260 squashed (do not merge) #291

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
97963ff
added ignore for input in value_set_fit::apply_code
lucasccordeiro Nov 2, 2016
62b3cea
do not remove assignments related to __CPROVER_initialize
lucasccordeiro Nov 2, 2016
8076914
remove virtual functions, function pointers, and returns before build…
lucasccordeiro Nov 2, 2016
fa10441
add test cases to check the full-slice option
lucasccordeiro Nov 2, 2016
f826a4e
add test case slice12
lucasccordeiro Nov 11, 2016
e126a1e
check whether symbol is a __CPROVER_rounding_mode
lucasccordeiro Nov 11, 2016
b53ac91
add test case slice13
lucasccordeiro Nov 11, 2016
bdc6b83
remove unused files from slice13
lucasccordeiro Nov 11, 2016
226b3f9
add makefile to cbmc-slice
lucasccordeiro Nov 11, 2016
efb1fc4
do not remove assignments related to dereference
lucasccordeiro Nov 11, 2016
42af01e
add test case slice14
lucasccordeiro Nov 11, 2016
0f2ea7b
add test case slice15
lucasccordeiro Nov 18, 2016
a77eb88
add test case slice16 from the paper 'On Slicing Programs with Jump S…
lucasccordeiro Nov 21, 2016
a9c1ea7
add function calls to the queue before computing the dependency graph
lucasccordeiro Nov 22, 2016
83d5b2e
update test desc for full-slice
lucasccordeiro Dec 13, 2016
5a82815
remove function pointers by adding the safety assertion
lucasccordeiro Dec 13, 2016
d59dd58
add test case related to equality through union
lucasccordeiro Dec 13, 2016
be2709c
consider assume statements during symbolic execution
lucasccordeiro Dec 13, 2016
fada618
add test case related to the exit function
lucasccordeiro Dec 13, 2016
ed9b801
execute full-slice after goto_check
lucasccordeiro Dec 13, 2016
c57f663
check whether a given state exists before adding dependencies
lucasccordeiro Dec 28, 2016
517fbd2
fix merge conflict in cbmc_parse_options.cpp
lucasccordeiro Dec 28, 2016
3bbca7c
check for array_copy during the implicit call
lucasccordeiro Jan 3, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions regression/cbmc-slice/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
default: tests.log

test:
@if ! ../test.pl -c ../../../src/cbmc/cbmc ; then \
../failed-tests-printer.pl ; \
exit 1 ; \
fi

tests.log: ../test.pl
@if ! ../test.pl -c ../../../src/cbmc/cbmc ; then \
../failed-tests-printer.pl ; \
exit 1 ; \
fi

show:
@for dir in *; do \
if [ -d "$$dir" ]; then \
vim -o "$$dir/*.c" "$$dir/*.out"; \
fi; \
done;
70 changes: 70 additions & 0 deletions regression/cbmc-slice/slice01/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>

typedef struct list
{
int key;
struct list *next;
} mlist;

mlist *head;

mlist* search_list(mlist *l, int k)
{
l = head;
while(l!=NULL && l->key!=k)
{
l = l->next;
}
return l;
}

int delete_list(mlist *l)
{
mlist *tmp;
tmp = head;
if (head != l)
{
while(tmp->next!=l)
tmp = tmp->next;
tmp->next = l->next;
}
else
{
head = l->next;
}
free(l);
return 0;
}

int insert_list(mlist *l, int k)
{
l = (mlist*)malloc(sizeof(mlist));
if (head==NULL)
{
l->key = k;
l->next = NULL;
}
else
{
l->key = k;
l->next = head;
}
head = l;
return 0;
}

int main(void)
{
int i;
mlist *mylist, *temp;
insert_list(mylist,2);
insert_list(mylist,5);
insert_list(mylist,1);
insert_list(mylist,3);
mylist = head;
temp = search_list(mylist,2);
assert(temp->key == 2);
delete_list(temp);
}
8 changes: 8 additions & 0 deletions regression/cbmc-slice/slice01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--unwind 2 --full-slice
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
73 changes: 73 additions & 0 deletions regression/cbmc-slice/slice02/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#include <stdio.h>

#define TRUE (1)
#define FALSE (0)
#define SIZE (10)
int topo=0;

void inc_topo(void){
topo++;
}

void dec_topo(void){
topo--;
}

int get_topo(void){
return topo;
}

int stack_empty(void){
(topo==0) ? TRUE : FALSE;
}

int push(int *stack, int x){
if (topo==SIZE) {
printf("stack overflow\n");
return -1;
} else {
stack[get_topo()] = x;
printf("push: stack[%d] = %d\n", get_topo(), stack[get_topo()]);
inc_topo();
}
}

int pop(int *stack){
if (get_topo()==0) {
printf("stack underflow\n");
return -1;
} else {
dec_topo();
printf("pop: stack[%d] = %d\n", get_topo(), stack[get_topo()]);
return stack[get_topo()];
}
}

int main(void) {
int arr[SIZE];

push(arr,3);
push(arr,4);
push(arr,5);
push(arr,1);
push(arr,9);
push(arr,10);
push(arr,6);
push(arr,12);
push(arr,15);
push(arr,8);
push(arr,20);

pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);
pop(arr);

}
8 changes: 8 additions & 0 deletions regression/cbmc-slice/slice02/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--pointer-check --full-slice
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
102 changes: 102 additions & 0 deletions regression/cbmc-slice/slice03/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
#include <stdio.h>

#define SIZE 10

typedef struct{
int elemento[SIZE];
int inicio;
int fim;
int quantidade;
} QType;

int inicializa(QType *q) {
q->inicio=0;
q->fim=0;
q->quantidade=0;
}

int empty(QType * q) {
if (q->inicio == q->fim) {
printf("queue is empty\n");
return -1;
}
else return 0;
}

int full(QType * q) {

if (q->quantidade == SIZE) {
printf("queue is full\n");
return -1;
} else{
return 0;
}
}

int enqueue(QType *q, int x) {
q->elemento[q->fim] = x;
q->quantidade++;
if (q->fim == SIZE) {
q->fim = 0;
} else {
q->fim++;
}
return 0;
}

int dequeue(QType *q) {

int x;

x = q->elemento[q->inicio];
q->quantidade--;
if (q->inicio == SIZE) {
q->inicio = 0;
} else {
q->inicio++;
}

return x;
}


int main(void) {

QType queue;

int i,temp;

inicializa(&queue);

empty(&queue);

enqueue(&queue,2);

empty(&queue);

enqueue(&queue,4);
enqueue(&queue,1);
enqueue(&queue,5);
enqueue(&queue,3);
enqueue(&queue,8);
enqueue(&queue,6);
enqueue(&queue,7);
enqueue(&queue,10);
enqueue(&queue,9);

full(&queue);

temp = dequeue(&queue);

printf("temp = %d\n", temp);

temp = dequeue(&queue);

printf("temp = %d\n", temp);

for(i=queue.inicio; i<queue.fim; i++){
printf("queue[%d] = %d\n", i, queue.elemento[i]);
}

return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc-slice/slice03/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--unwind 10 --pointer-check --bounds-check --full-slice
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
58 changes: 58 additions & 0 deletions regression/cbmc-slice/slice04/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
** float-rounder-bug.c
**
** Martin Brain
** [email protected]
** 20/05/13
**
** Another manifestation of the casting bug.
** If the number is in (0,0x1p-126) it is rounded to zero rather than a subnormal number.
*/
#include <assert.h>

#define FULP 1

void bug (float min) {
__CPROVER_assume(min == 0x1.fffffep-105f);
float modifier = (0x1.0p-23 * (1<<FULP));
float ulpdiff = min * modifier;

assert(ulpdiff == 0x1p-126f); // Should be true

return;
}

void bugBrokenOut (float min) {
__CPROVER_assume(min == 0x1.fffffep-105f);
float modifier = (0x1.0p-23 * (1<<FULP));
double dulpdiff = (double)min * (double)modifier; // Fine up to here
float ulpdiff = (float)dulpdiff; // Error

assert(ulpdiff == 0x1p-126f); // Should be true

return;
}

void bugCasting (double d) {
__CPROVER_assume(d == 0x1.fffffep-127);

float f = (float) d;

assert(f == 0x1p-126f); // Should be true

return;
}

int main (void) {
float f;
bug(f);

float g;
bugBrokenOut(g);

double d;
bugCasting(d);

return 1;
}

8 changes: 8 additions & 0 deletions regression/cbmc-slice/slice04/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--floatbv --full-slice
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
15 changes: 15 additions & 0 deletions regression/cbmc-slice/slice05/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
int main()
{
int x = 1; /* considering changing this line */
int y = 3;
int p = x + y;
int z = y -2;
int r = 0;

if(p==0)
r++;

assert(r==0);

return 0;
}
8 changes: 8 additions & 0 deletions regression/cbmc-slice/slice05/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
main.c
--full-slice
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
--
^warning: ignoring
Loading