diff options
Diffstat (limited to 'Test/extractloops')
-rw-r--r-- | Test/extractloops/detLoopExtract.bpl | 4 | ||||
-rw-r--r-- | Test/extractloops/detLoopExtract2.bpl | 27 | ||||
-rw-r--r-- | Test/extractloops/detLoopExtract2.bpl.expect | 2 | ||||
-rw-r--r-- | Test/extractloops/detLoopExtractNested.bpl | 23 | ||||
-rw-r--r-- | Test/extractloops/detLoopExtractNested.bpl.expect | 19 | ||||
-rw-r--r-- | Test/extractloops/t1.bpl | 86 | ||||
-rw-r--r-- | Test/extractloops/t2.bpl | 108 | ||||
-rw-r--r-- | Test/extractloops/t3.bpl | 86 |
8 files changed, 213 insertions, 142 deletions
diff --git a/Test/extractloops/detLoopExtract.bpl b/Test/extractloops/detLoopExtract.bpl index 7e9d0629..463cecf0 100644 --- a/Test/extractloops/detLoopExtract.bpl +++ b/Test/extractloops/detLoopExtract.bpl @@ -1,5 +1,5 @@ -// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 -deterministicExtractLoops -recursionBound:4 "%s" > "%t"
-// RUN: %diff "%s.expect" "%t"
+// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 -deterministicExtractLoops -recursionBound:4 "%s" > "%t" +// RUN: %diff "%s.expect" "%t" var g:int; var h:int; //not modified var k:int; //modified in a procedure call diff --git a/Test/extractloops/detLoopExtract2.bpl b/Test/extractloops/detLoopExtract2.bpl new file mode 100644 index 00000000..f2befc53 --- /dev/null +++ b/Test/extractloops/detLoopExtract2.bpl @@ -0,0 +1,27 @@ +// RUN: %boogie -nologo -nologo -stratifiedInline:1 -extractLoops -deterministicExtractLoops -recursionBound:6 "%s" > "%t" +// RUN: %diff "%s.expect" "%t" + +//This example checks the bug fix in the loop extract for http://symdiff.codeplex.com/workitem/4 +procedure {:entrypoint} Main() returns(r:int) +{ + var i, j : int; + var Flag : bool; + var b : bool; + i := 0; + j := 0; + Flag := false; + while(i<3) + { + havoc b; + if (b || Flag) { + i := i + 1; + j := j + 1; + } + else { + Flag := true; + j := j + 1; + } + } + assume !(i == j || i == j - 1); + return; +} diff --git a/Test/extractloops/detLoopExtract2.bpl.expect b/Test/extractloops/detLoopExtract2.bpl.expect new file mode 100644 index 00000000..37fad75c --- /dev/null +++ b/Test/extractloops/detLoopExtract2.bpl.expect @@ -0,0 +1,2 @@ + +Boogie program verifier finished with 1 verified, 0 errors diff --git a/Test/extractloops/detLoopExtractNested.bpl b/Test/extractloops/detLoopExtractNested.bpl new file mode 100644 index 00000000..65de20c1 --- /dev/null +++ b/Test/extractloops/detLoopExtractNested.bpl @@ -0,0 +1,23 @@ +// RUN: %boogie -nologo -stratifiedInline:1 -extractLoops -deterministicExtractLoops -recursionBound:100 "%s" > "%t" +// RUN: %diff "%s.expect" "%t" + +//This example checks the bug fix in the loop extract for http://symdiff.codeplex.com/workitem/1 + +var t: int; +procedure {:entrypoint} NestedLoops() +modifies t; +//ensures t == 6; +{ + var i:int, j:int; + i, j, t := 0, 0, 0; + while(i < 2) { + j := 0; + while (j < 3) { + t := t + 1; + j := j + 1; + } + i := i + 1; + } + assume true; //would be provable (!true) wihtout the fix +} + diff --git a/Test/extractloops/detLoopExtractNested.bpl.expect b/Test/extractloops/detLoopExtractNested.bpl.expect new file mode 100644 index 00000000..f4932ede --- /dev/null +++ b/Test/extractloops/detLoopExtractNested.bpl.expect @@ -0,0 +1,19 @@ +(0,0): Error BP5001: This assertion might not hold. +Execution trace: + detLoopExtractNested.bpl(12,12): anon0 + detLoopExtractNested.bpl(14,8): anon5_LoopBody + detLoopExtractNested.bpl(16,10): anon6_LoopBody + detLoopExtractNested.bpl(16,10): anon6_LoopBody + detLoopExtractNested.bpl(16,10): anon6_LoopBody + detLoopExtractNested.bpl(15,6): anon6_LoopDone + detLoopExtractNested.bpl(15,6): anon6_LoopDone + detLoopExtractNested.bpl(14,8): anon5_LoopBody + detLoopExtractNested.bpl(16,10): anon6_LoopBody + detLoopExtractNested.bpl(16,10): anon6_LoopBody + detLoopExtractNested.bpl(16,10): anon6_LoopBody + detLoopExtractNested.bpl(15,6): anon6_LoopDone + detLoopExtractNested.bpl(15,6): anon6_LoopDone + detLoopExtractNested.bpl(13,4): anon5_LoopDone + detLoopExtractNested.bpl(13,4): anon5_LoopDone + +Boogie program verifier finished with 0 verified, 1 error diff --git a/Test/extractloops/t1.bpl b/Test/extractloops/t1.bpl index a0ebb0b8..731c4e44 100644 --- a/Test/extractloops/t1.bpl +++ b/Test/extractloops/t1.bpl @@ -1,43 +1,43 @@ -// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 "%s" > "%t"
-// RUN: %diff "%s.expect" "%t"
-var g: int;
-
-
-
-procedure foo()
-{
- var t: int;
- t := 0;
-}
-
-procedure {:entrypoint} A()
-modifies g;
-{
- var x: int;
- var y: int;
-
- anon0:
- assume g == 0;
- x := 4;
- goto anon3_LoopHead;
-
- anon3_LoopHead:
- call foo();
- goto anon3_LoopDone, anon3_LoopBody;
-
- anon3_LoopBody:
- assume g < x;
- g := g + 1;
- x := x - 1;
- goto anon3_LoopHead;
-
- anon3_LoopDone:
- assume g >= x;
- goto anon2;
-
- anon2:
- assume x != 1;
- return;
-}
-
-
+// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 "%s" > "%t" +// RUN: %diff "%s.expect" "%t" +var g: int; + + + +procedure foo() +{ + var t: int; + t := 0; +} + +procedure {:entrypoint} A() +modifies g; +{ + var x: int; + var y: int; + + anon0: + assume g == 0; + x := 4; + goto anon3_LoopHead; + + anon3_LoopHead: + call foo(); + goto anon3_LoopDone, anon3_LoopBody; + + anon3_LoopBody: + assume g < x; + g := g + 1; + x := x - 1; + goto anon3_LoopHead; + + anon3_LoopDone: + assume g >= x; + goto anon2; + + anon2: + assume x != 1; + return; +} + + diff --git a/Test/extractloops/t2.bpl b/Test/extractloops/t2.bpl index d62733f7..39d65292 100644 --- a/Test/extractloops/t2.bpl +++ b/Test/extractloops/t2.bpl @@ -1,54 +1,54 @@ -// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 "%s" > "%t"
-// RUN: %diff "%s.expect" "%t"
-var g: int;
-
-
-procedure foo()
-{
- var t: int;
- t := 0;
-}
-
-procedure {:entrypoint} A()
-modifies g;
-{
- var x: int;
- var y: int;
-
- anon0:
- assume g == 0;
- x := 4;
- goto anon3_LoopHead;
-
- anon3_LoopHead:
- call foo();
- goto anon3_LoopDone, anon3_LoopBody;
-
- anon3_LoopBody:
- assume g < x;
- g := g + 1;
- x := x - 1;
- y := 0;
- goto lab1_LoopHead;
-
- lab1_LoopHead:
- goto lab1_LoopBody, lab1_LoopDone;
-
- lab1_LoopBody:
- assume y < 2;
- y := y + 1;
- goto lab1_LoopHead;
-
- lab1_LoopDone:
- assume y >= 2;
- goto anon3_LoopHead;
-
- anon3_LoopDone:
- assume g >= x;
- goto anon2;
-
- anon2:
- return;
-}
-
-
+// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 "%s" > "%t" +// RUN: %diff "%s.expect" "%t" +var g: int; + + +procedure foo() +{ + var t: int; + t := 0; +} + +procedure {:entrypoint} A() +modifies g; +{ + var x: int; + var y: int; + + anon0: + assume g == 0; + x := 4; + goto anon3_LoopHead; + + anon3_LoopHead: + call foo(); + goto anon3_LoopDone, anon3_LoopBody; + + anon3_LoopBody: + assume g < x; + g := g + 1; + x := x - 1; + y := 0; + goto lab1_LoopHead; + + lab1_LoopHead: + goto lab1_LoopBody, lab1_LoopDone; + + lab1_LoopBody: + assume y < 2; + y := y + 1; + goto lab1_LoopHead; + + lab1_LoopDone: + assume y >= 2; + goto anon3_LoopHead; + + anon3_LoopDone: + assume g >= x; + goto anon2; + + anon2: + return; +} + + diff --git a/Test/extractloops/t3.bpl b/Test/extractloops/t3.bpl index 023a9adb..9e7720ec 100644 --- a/Test/extractloops/t3.bpl +++ b/Test/extractloops/t3.bpl @@ -1,43 +1,43 @@ -// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 -recursionBound:2 "%s" > "%t"
-// RUN: %diff "%s.rb2.expect" "%t"
-// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 -recursionBound:4 "%s" > "%t"
-// RUN: %diff "%s.rb4.expect" "%t"
-var g: int;
-
-procedure foo()
-{
- var t: int;
- t := 0;
-}
-
-procedure {:entrypoint} A()
-modifies g;
-{
- var x: int;
- var y: int;
-
- anon0:
- assume g == 0;
- x := 4;
- goto anon3_LoopHead, anon3_LoopBody;
-
- anon3_LoopHead:
- call foo();
- goto anon3_LoopDone, anon3_LoopBody;
-
- anon3_LoopBody:
- assume g < x;
- g := g + 1;
- x := x - 1;
- goto anon3_LoopHead;
-
- anon3_LoopDone:
- assume g >= x;
- goto anon2;
-
- anon2:
- assume x != 1;
- return;
-}
-
-
+// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 -recursionBound:2 "%s" > "%t" +// RUN: %diff "%s.rb2.expect" "%t" +// RUN: %boogie -stratifiedInline:1 -extractLoops -removeEmptyBlocks:0 -coalesceBlocks:0 -recursionBound:4 "%s" > "%t" +// RUN: %diff "%s.rb4.expect" "%t" +var g: int; + +procedure foo() +{ + var t: int; + t := 0; +} + +procedure {:entrypoint} A() +modifies g; +{ + var x: int; + var y: int; + + anon0: + assume g == 0; + x := 4; + goto anon3_LoopHead, anon3_LoopBody; + + anon3_LoopHead: + call foo(); + goto anon3_LoopDone, anon3_LoopBody; + + anon3_LoopBody: + assume g < x; + g := g + 1; + x := x - 1; + goto anon3_LoopHead; + + anon3_LoopDone: + assume g >= x; + goto anon2; + + anon2: + assume x != 1; + return; +} + + |