Skip to content

New goto-analyzer infrastructure #264

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
wants to merge 24 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
51eb520
Add XML and JSON output to the base of both domains and analysis.
Sep 8, 2016
b4aaab5
Make evaluation and/or simplification of conditions a domain operation.
Sep 8, 2016
1283be2
Refactor goto-analyze so that task, analysis, domain and output can a…
Sep 9, 2016
9fe825b
Fixes for the previous commit.
Sep 9, 2016
6f4ce96
Remove the special case handling of --show-intervals. --show --inter…
Sep 9, 2016
92bd719
Lucas' improvements and fixes to the constant and interval domains.
Sep 9, 2016
9371ffc
Lucas' rather fantastic regression tests.
Sep 9, 2016
76cb0eb
Make the help text more consistent.
Sep 9, 2016
0b8e479
Add a missing flag.
Sep 9, 2016
c018a31
Update the flags used to match the refactoring.
Sep 9, 2016
d087058
Correct the statistics printed by the simplifier.
Sep 9, 2016
2c4fede
... and again ...
Sep 9, 2016
b88e678
Improve the simplification of the constant domain.
Sep 9, 2016
5792ff1
Simplify arguments to function calls.
Sep 9, 2016
1fa7691
s/sequential/flow-sensitive/ as there are other sequential analyses.
Oct 24, 2016
273d23e
Add an extra argument to domain_simplify so that the left hand side o…
Oct 24, 2016
0a5d365
Add a caveat that failures are only assertion failures if they are re…
Oct 24, 2016
a7be3a6
Update and check the test cases. FUTURE for things where precision i…
Oct 24, 2016
5ff9c51
Fix an ambiguity in method overloading.
Oct 27, 2016
0ca3ece
Improve error reporting for unsupported combinations of task / interp…
Oct 27, 2016
dee1f4b
Add output_json to the dependence_graph abstract domain.
Nov 1, 2016
8cddfbb
... and the header file ...
Nov 1, 2016
d44063a
Add support for generating the dependency graph to goto-analyze, incl…
Nov 1, 2016
15e3e3c
Dot output needs to be in a graph.
Nov 1, 2016
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
6 changes: 6 additions & 0 deletions regression/goto-analyzer/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,9 @@ show:
vim -o "$$dir/*.java" "$$dir/*.out"; \
fi; \
done;

clean:
find . -name *.*~ | xargs rm -f
find . -name *.out | xargs rm -f
find . -name *.goto | xargs rm -f
rm -f tests.log
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <assert.h>

int main()
{
int i, j=20;

if (j==20)
{
int x=1,y=2,z;
z=x+y;
assert(z==3);
}

}
9 changes: 9 additions & 0 deletions regression/goto-analyzer/constant_propagation_01/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
constant_propagation1.c
--constants --simplify out.goto
^EXIT=0$
^SIGNAL=0$
^SIMPLIFIED: assert: 1, assume: 0, goto: 2, assigns: 5, function calls: 0$
^UNMODIFIED: assert: 0, assume: 0, goto: 0, assigns: 12, function calls: 2$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>

int main()
{
int i=0, j=2;

if (i==0)
{
i++;
j++;
}
assert(j!=3);
}
3 changes: 3 additions & 0 deletions regression/goto-analyzer/constant_propagation_02/original
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Task defaults to --show
Domain defaults to --constants
GOTO-ANALYSER version 5.5 64-bit x86_64 linux
81 changes: 81 additions & 0 deletions regression/goto-analyzer/constant_propagation_02/simplified
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
Reading GOTO program from `out.goto'
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

main /* main */
// 0 file constant_propagation_02.c line 5 function main
signed int i;
// 1 file constant_propagation_02.c line 5 function main
i = 0;
// 2 file constant_propagation_02.c line 5 function main
signed int j;
// 3 file constant_propagation_02.c line 5 function main
j = 2;
// 4 file constant_propagation_02.c line 7 function main
IF FALSE THEN GOTO 1
// 5 file constant_propagation_02.c line 9 function main
0 = 1;
// 6 file constant_propagation_02.c line 10 function main
2 = 3;
// 7 no location
1: SKIP
// 8 file constant_propagation_02.c line 12 function main
ASSERT FALSE // assertion j!=3
// 9 file constant_propagation_02.c line 12 function main
GOTO 2
// 10 file constant_propagation_02.c line 12 function main
(void)0;
// 11 no location
2: SKIP
// 12 file constant_propagation_02.c line 13 function main
dead j;
// 13 file constant_propagation_02.c line 13 function main
dead i;
// 14 file constant_propagation_02.c line 13 function main
main#return_value = NONDET(signed int);
// 15 file constant_propagation_02.c line 13 function main
END_FUNCTION
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

_start /* _start */
// 16 no location
__CPROVER_initialize();
// 17 file constant_propagation_02.c line 3
main();
// 18 file constant_propagation_02.c line 3
return' = main#return_value;
// 19 file constant_propagation_02.c line 3
dead main#return_value;
// 20 file constant_propagation_02.c line 3
OUTPUT("return", return');
// 21 no location
END_FUNCTION
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

__CPROVER_initialize /* __CPROVER_initialize */
// 22 no location
// Labels: __CPROVER_HIDE
SKIP
// 23 file <built-in-additions> line 39
__CPROVER_dead_object = NULL;
// 24 file <built-in-additions> line 38
__CPROVER_deallocated = NULL;
// 25 file <built-in-additions> line 42
__CPROVER_malloc_is_new_array = FALSE;
// 26 file <built-in-additions> line 40
__CPROVER_malloc_object = NULL;
// 27 file <built-in-additions> line 41
__CPROVER_malloc_size = 0ul;
// 28 file <built-in-additions> line 43
__CPROVER_memory_leak = NULL;
// 29 file <built-in-additions> line 31
__CPROVER_next_thread_id = 0ul;
// 30 file <built-in-additions> line 85
__CPROVER_pipe_count = 0u;
// 31 file <built-in-additions> line 65
__CPROVER_rounding_mode = 0;
// 32 file <built-in-additions> line 29
__CPROVER_thread_id = 0ul;
// 33 file <built-in-additions> line 30
__CPROVER_threads_exited = ARRAY_OF(FALSE);
// 34 no location
END_FUNCTION
9 changes: 9 additions & 0 deletions regression/goto-analyzer/constant_propagation_02/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
constant_propagation_02.c
--constants --simplify out.goto
^EXIT=0$
^SIGNAL=0$
^SIMPLIFIED: assert: 1, assume: 0, goto: 2, assigns: 6, function calls: 0$
^UNMODIFIED: assert: 0, assume: 0, goto: 0, assigns: 11, function calls: 2$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>

int main()
{
int i=0, j=2;

if (i==0)
{
i++;
j++;
}
assert(j==3);
}
9 changes: 9 additions & 0 deletions regression/goto-analyzer/constant_propagation_03/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
constant_propagation_03.c
--constants --simplify out.goto
^EXIT=0$
^SIGNAL=0$
^SIMPLIFIED: assert: 1, assume: 0, goto: 2, assigns: 6, function calls: 0$
^UNMODIFIED: assert: 0, assume: 0, goto: 0, assigns: 11, function calls: 2$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>

int main()
{
int i=0, j=2;

if (i<50)
{
i++;
j++;
}
assert(j==3);
}
9 changes: 9 additions & 0 deletions regression/goto-analyzer/constant_propagation_04/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
constant_propagation_04.c
--constants --simplify out.goto
^EXIT=0$
^SIGNAL=0$
^SIMPLIFIED: assert: 1, assume: 0, goto: 2, assigns: 6, function calls: 0$
^UNMODIFIED: assert: 0, assume: 0, goto: 0, assigns: 11, function calls: 2$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#include <assert.h>

int main()
{
int i=0, j=2;

if (i<50)
{
i++;
j++;
}
assert(j!=3);
}
8 changes: 8 additions & 0 deletions regression/goto-analyzer/constant_propagation_05/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
constant_propagation_05.c
--constants --verify
^EXIT=0$
^SIGNAL=0$
^\[main.assertion.1\] file constant_propagation_05.c line 12 function main, assertion j!=3: FAILURE (if reachable)$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#include <assert.h>

int main()
{
int i, j=20;

if(i>=20)
assert(i>=10); // success

if(i>=10 && i<=20)
assert(i!=30); // success

if(i>=10 && i<=20)
assert(i!=15); // fails

if(i<1 && i>10)
assert(0); // success

if(i>=10 && j>=i)
assert(j>=10); // success

if(i>=j)
assert(i>=j); // unknown

if(i>10)
assert(i>=11); // success

if(i<=100 && j<i)
assert(j<100); // success
}
15 changes: 15 additions & 0 deletions regression/goto-analyzer/constant_propagation_06/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
CORE
constant_propagation_06.c
--intervals --verify
^EXIT=0$
^SIGNAL=0$
^\[main.assertion.1\] file constant_propagation_06.c line 8 function main, assertion i>=10: SUCCESS$
^\[main.assertion.2\] file constant_propagation_06.c line 11 function main, assertion i!=30: SUCCESS$
^\[main.assertion.3\] file constant_propagation_06.c line 14 function main, assertion i!=15: UNKNOWN$
^\[main.assertion.4\] file constant_propagation_06.c line 17 function main, assertion 0: SUCCESS$
^\[main.assertion.5\] file constant_propagation_06.c line 20 function main, assertion j>=10: SUCCESS$
^\[main.assertion.6\] file constant_propagation_06.c line 23 function main, assertion i>=j: UNKNOWN$
^\[main.assertion.7\] file constant_propagation_06.c line 26 function main, assertion i>=11: SUCCESS$
^\[main.assertion.8\] file constant_propagation_06.c line 29 function main, assertion j<100: SUCCESS$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <assert.h>

int main()
{
int i=0, j=2;

while (i<50)
{
i++;
j++;
}
assert(i<51);
}

8 changes: 8 additions & 0 deletions regression/goto-analyzer/constant_propagation_07/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
CORE
constant_propagation_07.c
--constants --verify
^EXIT=0$
^SIGNAL=0$
^\[main.assertion.1\] file constant_propagation_07.c line 12 function main, assertion i<51: UNKNOWN$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#include <assert.h>

int main()
{
int i=0, j=2;

while (i<=50)
{
i++;
j++;
}
assert(i<50);
assert(i<51);
assert(i<52);
}

10 changes: 10 additions & 0 deletions regression/goto-analyzer/constant_propagation_08/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FUTURE
constant_propagation_08.c
--intervals --verify
^EXIT=0$
^SIGNAL=0$
^\[main.assertion.1\] file constant_propagation_08.c line 12 function main, assertion i<50: UNKNOWN$
^\[main.assertion.2\] file constant_propagation_08.c line 13 function main, assertion i<51: UNKNOWN$
^\[main.assertion.3\] file constant_propagation_08.c line 14 function main, assertion i<52: SUCCESS$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#include <assert.h>

int main()
{
int i=0, j=2;

while (i<=50)
{
i++;
j++;
}
assert(j<52);
}

9 changes: 9 additions & 0 deletions regression/goto-analyzer/constant_propagation_09/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
constant_propagation_09.c
--intervals --verify
^EXIT=0$
^SIGNAL=0$
******** Function main
^\[main.assertion.1\] file constant_propagation_09.c line 12 function main, assertion j<52: UNKNOWN$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <assert.h>
int main()
{
signed int i;
signed int j;
i = 0;
if(!(i >= 2))
{
j = j + 1;
i = i + 1;
if(!(i >= 2))
{
j = j + 1;
i = i + 1;
if(!(i >= 2))
{
j = j + 1;
i = i + 1;
}
assert(!(i < 2));
}
}
return 0;
}

9 changes: 9 additions & 0 deletions regression/goto-analyzer/constant_propagation_10/test.desc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
CORE
constant_propagation_10.c
--constants --simplify out.goto
^EXIT=0$
^SIGNAL=0$
^SIMPLIFIED: assert: 1, assume: 0, goto: 4, assigns: 10, function calls: 0$
^UNMODIFIED: assert: 0, assume: 0, goto: 1, assigns: 10, function calls: 2$
--
^warning: ignoring
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#include <assert.h>
int main()
{
int a[2];
int i;
i = 0;

if (i==0)
a[0]=1;
else
a[1]=2;

assert(a[0]==1 || a[1]==2);

return 0;
}

Loading