-
Notifications
You must be signed in to change notification settings - Fork 273
Aggressive slicer v2 #2385
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
Aggressive slicer v2 #2385
Changes from all commits
357358d
de7e1af
2954205
4ac9199
aa4848d
ea085d3
8c7dc17
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// test should pass. Shortest path main -> C -> D | ||
void D() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
|
||
__CPROVER_assume(nondet != 3); | ||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--aggressive-slice | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// test should pass. Shortest path is preserved, main -> C -> D, | ||
// but is not a possible counterexample because of assumption that | ||
// nondet != 3 | ||
|
||
void D() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
|
||
__CPROVER_assume(nondet != 3); | ||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--aggressive-slice --property D.assertion.1 | ||
^EXIT=0$ | ||
^SIGNAL=0$ | ||
^VERIFICATION SUCCESSFUL$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// test should fail. Shortest path is preserved, main -> C -> D, | ||
void D() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
|
||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--aggressive-slice | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// test should fail | ||
// shortest path only is not sufficient to violate assertion, | ||
// but we specifically require that function B is kept, which | ||
// allows path main -> B -> C -> D | ||
|
||
void D() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
__CPROVER_assume(nondet != 3); | ||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--aggressive-slice --aggressive-slice-preserve-function B | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
// Test should fail. Shortest path only is not sufficient | ||
// due to assumption that nondet !=3, but | ||
// preserve-all-direct-paths preserves the path main -> B -> C -> D. | ||
|
||
void D() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
__CPROVER_assume(nondet != 3); | ||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The file aggressive_slicer5/test.binary must not be committed. |
||
--aggressive-slice --property D.assertion.1 --aggressive-slice-preserve-all-direct-paths | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
// Test should fail | ||
// Assertion in D is reachable when call depth of 1 is preserved, | ||
// Shortest path = main -> C -> D, which is not possible due to assumption | ||
// nondet!=3, but call depth 1 preserves the body of function B, which can also reach | ||
// C. | ||
|
||
void D() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider adding a test case with more than one property, so specifying a property makes a difference? |
||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
__CPROVER_assume(nondet != 3); | ||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--aggressive-slice --aggressive-slice-call-depth 1 | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Test should fail | ||
// Assertion in D is reachable by main -> C -> D | ||
// Assertion in E is reachable by main -> E | ||
|
||
void D() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
void C() | ||
{ | ||
int nondet; | ||
if(nondet) | ||
D(); | ||
} | ||
|
||
void B() | ||
{ | ||
C(); | ||
}; | ||
|
||
void E() | ||
{ | ||
__CPROVER_assert(0, ""); | ||
} | ||
|
||
int main() | ||
{ | ||
int nondet; | ||
|
||
switch(nondet) | ||
{ | ||
case 1: | ||
B(); | ||
break; | ||
case 2: | ||
E(); | ||
break; | ||
case 3: | ||
C(); | ||
break; | ||
default: | ||
break; | ||
} | ||
return 0; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
CORE | ||
main.c | ||
--aggressive-slice | ||
^EXIT=10$ | ||
^SIGNAL=0$ | ||
^VERIFICATION FAILED$ | ||
-- | ||
^warning: ignoring |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly for the rest of these tests -- briefly comment stating the intent of the test, either in the source or the desc file