Skip to content

consider array_copy expressions in the full-slice #694

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

Merged
merged 2 commits into from
Mar 24, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
19 changes: 19 additions & 0 deletions regression/goto-instrument/slice22/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <stdlib.h>
#include <assert.h>

int main()
{
int *ptr=malloc(sizeof(int));
*ptr=42;
ptr=realloc(ptr, 20);
assert(*ptr==42);

int *ptr2=malloc(2*sizeof(int));
*ptr2=42;
*(ptr2+1)=42;
ptr2=realloc(ptr2, 20);
assert(*ptr2==42);
assert(*(ptr2+1)==42);

return 0;
}
6 changes: 6 additions & 0 deletions regression/goto-instrument/slice22/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
main.c
--full-slice --add-library
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
25 changes: 25 additions & 0 deletions regression/goto-instrument/slice23/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <stdlib.h>
#include <assert.h>

void foo(int argc)
{
void* x=0;

if(argc>3)
x=malloc(4*sizeof(int));
else
x=malloc(3*sizeof(int));
*(int*)x=42;

x=realloc(x, sizeof(int));

assert(*(int*)x==42);
}

int main(int argc, char* argv[])
{
//__CPROVER_ASYNC_1:
foo(argc);

return 0;
}
6 changes: 6 additions & 0 deletions regression/goto-instrument/slice23/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
CORE
main.c
--full-slice --add-library
^EXIT=0$
^SIGNAL=0$
^VERIFICATION SUCCESSFUL$
4 changes: 4 additions & 0 deletions src/goto-instrument/full_slicer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,10 @@ static bool implicit(goto_programt::const_targett target)
{
// some variables are used during symbolic execution only

const irep_idt &statement=target->code.get_statement();
if(statement==ID_array_copy)
return true;

if(!target->is_assign())
return false;

Expand Down
3 changes: 3 additions & 0 deletions src/pointer-analysis/value_set_fi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1729,6 +1729,9 @@ void value_set_fit::apply_code(
else if(statement==ID_fence)
{
}
else if(statement==ID_array_copy)
{
}
else if(statement==ID_input || statement==ID_output)
{
// doesn't do anything
Expand Down