From 06aadffd71f2d96070703371c62bd0e14c76b91f Mon Sep 17 00:00:00 2001 From: wuestholz Date: Fri, 4 Jul 2014 03:52:02 +0200 Subject: Implemented an optimization for assignments to assumption variables that are injected by the verification result caching for calls within loops. --- Test/snapshots/Snapshots17.v0.bpl | 32 ++++++++++++++++++++++++++++++++ Test/snapshots/Snapshots17.v1.bpl | 32 ++++++++++++++++++++++++++++++++ Test/snapshots/Snapshots18.v0.bpl | 24 ++++++++++++++++++++++++ Test/snapshots/Snapshots18.v1.bpl | 24 ++++++++++++++++++++++++ Test/snapshots/runtest.snapshot | 2 +- Test/snapshots/runtest.snapshot.expect | 31 +++++++++++++++++++++++++++++++ 6 files changed, 144 insertions(+), 1 deletion(-) create mode 100644 Test/snapshots/Snapshots17.v0.bpl create mode 100644 Test/snapshots/Snapshots17.v1.bpl create mode 100644 Test/snapshots/Snapshots18.v0.bpl create mode 100644 Test/snapshots/Snapshots18.v1.bpl (limited to 'Test/snapshots') diff --git a/Test/snapshots/Snapshots17.v0.bpl b/Test/snapshots/Snapshots17.v0.bpl new file mode 100644 index 00000000..58ef53e7 --- /dev/null +++ b/Test/snapshots/Snapshots17.v0.bpl @@ -0,0 +1,32 @@ +procedure {:checksum "0"} M(); + +implementation {:id "M"} {:checksum "1"} M() +{ + var x: int; + + x := 0; + while (*) + { + while (*) + { + assert true; + + call N(); + + call N(); + + x := x + 1; + + assert x == 1; + } + + call N(); + + assert false; + } + + assert true; +} + +procedure {:checksum "2"} N(); + ensures false; diff --git a/Test/snapshots/Snapshots17.v1.bpl b/Test/snapshots/Snapshots17.v1.bpl new file mode 100644 index 00000000..4d22ab3d --- /dev/null +++ b/Test/snapshots/Snapshots17.v1.bpl @@ -0,0 +1,32 @@ +procedure {:checksum "0"} M(); + +implementation {:id "M"} {:checksum "1"} M() +{ + var x: int; + + x := 0; + while (*) + { + while (*) + { + assert true; + + call N(); + + call N(); + + x := x + 1; + + assert x == 1; // error + } + + call N(); + + assert false; // error + } + + assert true; +} + +procedure {:checksum "3"} N(); + ensures true; diff --git a/Test/snapshots/Snapshots18.v0.bpl b/Test/snapshots/Snapshots18.v0.bpl new file mode 100644 index 00000000..d37d9546 --- /dev/null +++ b/Test/snapshots/Snapshots18.v0.bpl @@ -0,0 +1,24 @@ +procedure {:checksum "0"} M(); + +implementation {:id "M"} {:checksum "1"} M() +{ + while (true) + { + assert 0 == 0; + + call N(); + call N(); + + if (*) + { + break; + } + + assert 1 != 1; + } + + assert 2 != 2; +} + +procedure {:checksum "2"} N(); + ensures false; diff --git a/Test/snapshots/Snapshots18.v1.bpl b/Test/snapshots/Snapshots18.v1.bpl new file mode 100644 index 00000000..76f8c597 --- /dev/null +++ b/Test/snapshots/Snapshots18.v1.bpl @@ -0,0 +1,24 @@ +procedure {:checksum "0"} M(); + +implementation {:id "M"} {:checksum "1"} M() +{ + while (true) + { + assert 0 == 0; + + call N(); + call N(); + + if (*) + { + break; + } + + assert 1 != 1; // error + } + + assert 2 != 2; // error +} + +procedure {:checksum "3"} N(); + ensures true; diff --git a/Test/snapshots/runtest.snapshot b/Test/snapshots/runtest.snapshot index ffa54a53..e2d566d8 100644 --- a/Test/snapshots/runtest.snapshot +++ b/Test/snapshots/runtest.snapshot @@ -1,2 +1,2 @@ -// RUN: %boogie -verifySnapshots:2 -verifySeparately Snapshots0.bpl Snapshots1.bpl Snapshots2.bpl Snapshots3.bpl Snapshots4.bpl Snapshots5.bpl Snapshots6.bpl Snapshots7.bpl Snapshots8.bpl Snapshots9.bpl Snapshots10.bpl Snapshots11.bpl Snapshots12.bpl Snapshots13.bpl Snapshots14.bpl Snapshots15.bpl Snapshots16.bpl > "%t" +// RUN: %boogie -verifySnapshots:2 -verifySeparately Snapshots0.bpl Snapshots1.bpl Snapshots2.bpl Snapshots3.bpl Snapshots4.bpl Snapshots5.bpl Snapshots6.bpl Snapshots7.bpl Snapshots8.bpl Snapshots9.bpl Snapshots10.bpl Snapshots11.bpl Snapshots12.bpl Snapshots13.bpl Snapshots14.bpl Snapshots15.bpl Snapshots16.bpl Snapshots17.bpl Snapshots18.bpl > "%t" // RUN: %diff "%s.expect" "%t" diff --git a/Test/snapshots/runtest.snapshot.expect b/Test/snapshots/runtest.snapshot.expect index 41193348..8b363791 100644 --- a/Test/snapshots/runtest.snapshot.expect +++ b/Test/snapshots/runtest.snapshot.expect @@ -149,3 +149,34 @@ Execution trace: Snapshots16.v1.bpl(14,5): anon0 Boogie program verifier finished with 0 verified, 1 error + +Boogie program verifier finished with 1 verified, 0 errors +Snapshots17.v1.bpl(20,13): Error BP5001: This assertion might not hold. +Execution trace: + Snapshots17.v1.bpl(7,7): anon0 + Snapshots17.v1.bpl(10,9): anon6_LoopHead + Snapshots17.v1.bpl(12,13): anon6_LoopBody +Snapshots17.v1.bpl(25,9): Error BP5001: This assertion might not hold. +Execution trace: + Snapshots17.v1.bpl(7,7): anon0 + Snapshots17.v1.bpl(10,9): anon6_LoopHead + Snapshots17.v1.bpl(10,9): anon6_LoopDone + +Boogie program verifier finished with 0 verified, 2 errors + +Boogie program verifier finished with 1 verified, 0 errors +Snapshots18.v1.bpl(17,9): Error BP5001: This assertion might not hold. +Execution trace: + Snapshots18.v1.bpl(5,5): anon0 + Snapshots18.v1.bpl(5,5): anon5_LoopHead + Snapshots18.v1.bpl(7,9): anon5_LoopBody + Snapshots18.v1.bpl(12,9): anon6_Else +Snapshots18.v1.bpl(20,5): Error BP5001: This assertion might not hold. +Execution trace: + Snapshots18.v1.bpl(5,5): anon0 + Snapshots18.v1.bpl(5,5): anon5_LoopHead + Snapshots18.v1.bpl(7,9): anon5_LoopBody + Snapshots18.v1.bpl(14,13): anon6_Then + Snapshots18.v1.bpl(20,5): anon4 + +Boogie program verifier finished with 0 verified, 2 errors -- cgit v1.2.3