Skip to content
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

New goto-analyzer infrastructure : take 2 #315

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
9301cb6
Add XML and JSON output to the base of both domains and analysis.
Sep 8, 2016
860031b
Make evaluation and/or simplification of conditions a domain operation.
Sep 8, 2016
1246ba5
Refactor goto-analyze so that task, analysis, domain and output can a…
Sep 9, 2016
1b5b23b
Fixes for the previous commit.
Sep 9, 2016
01e744b
Remove the special case handling of --show-intervals. --show --inter…
Sep 9, 2016
9bc0e26
Lucas' improvements and fixes to the constant and interval domains.
Sep 9, 2016
d64b6f1
Lucas' rather fantastic regression tests.
Sep 9, 2016
4fa0726
Make the help text more consistent.
Sep 9, 2016
94d8790
Add a missing flag.
Sep 9, 2016
03cbb19
Update the flags used to match the refactoring.
Sep 9, 2016
ccf7579
Correct the statistics printed by the simplifier.
Sep 9, 2016
fc44137
... and again ...
Sep 9, 2016
60cb0b6
Improve the simplification of the constant domain.
Sep 9, 2016
c52d799
Simplify arguments to function calls.
Sep 9, 2016
743c803
s/sequential/flow-sensitive/ as there are other sequential analyses.
Oct 24, 2016
fe7f88b
Add an extra argument to domain_simplify so that the left hand side o…
Oct 24, 2016
1e5522a
Add a caveat that failures are only assertion failures if they are re…
Oct 24, 2016
99d945a
Update and check the test cases. FUTURE for things where precision i…
Oct 24, 2016
4f1a859
Fix an ambiguity in method overloading.
Oct 27, 2016
e829f9a
Improve error reporting for unsupported combinations of task / interp…
Oct 27, 2016
05769c4
Add output_json to the dependence_graph abstract domain.
Nov 1, 2016
499d911
... and the header file ...
Nov 1, 2016
db28f6e
Add support for generating the dependency graph to goto-analyze, incl…
Nov 1, 2016
94938ca
Dot output needs to be in a graph.
Nov 1, 2016
f17ccbb
Fix a travis build failure.
Nov 14, 2016
564a2ed
Finish fixing the travis issue.
Nov 14, 2016
699dde8
Improve handling of exceptions.
Nov 14, 2016
966f823
Implement feature request for simpler JSON output.
Nov 14, 2016
96c27b7
Add support for reachability slicing after simplification; disabled f…
Nov 17, 2016
22a3ce3
Add a utility function for removing unreachable instructions from all…
Nov 17, 2016
dc03382
An alternative approach to slicing unreachable instructions.
Nov 17, 2016
34a0268
Consistent capitalisation of status messages.
Nov 17, 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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

*.out, etc. should be quoted. Otherwise it wouldn't work if there is a file in the same directory matching the pattern.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While at it: one could use find ... -delete instead of find ... | xargs rm -f

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this accidentally added?

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accidentally added?

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
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some regression tests currently fail. I think we should mark them as FUTURE for now.

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