-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed error reporting counter example + avoid null pointer exceptions (…
- Loading branch information
1 parent
845e71f
commit ffffb3b
Showing
4 changed files
with
70 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// RUN: %dafny_0 /compile:0 "%s" /extractCounterexample /mv model > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
method foo(n: nat) returns (ret: array<string>) | ||
{ | ||
ret := new string[n]; | ||
|
||
var i := 0; | ||
while i < n | ||
invariant 0 <= i <= n | ||
invariant forall j :: 0 <= j < i ==> j % 2 == 0 ==> ret[j] == "even" | ||
invariant forall j :: 0 <= j < i ==> j % 2 == 1 ==> ret[j] == "odd" | ||
{ | ||
if i % 2 == 0 { | ||
ret[i] := "odd"; | ||
} else { | ||
ret[i] := "even"; | ||
} | ||
i := i + 1; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
git-issue-2026.dfy(11,18): Error: This loop invariant might not be maintained by the loop. | ||
git-issue-2026.dfy(11,18): Related message: loop invariant violation | ||
git-issue-2026.dfy(12,18): Error: This loop invariant might not be maintained by the loop. | ||
git-issue-2026.dfy(12,18): Related message: loop invariant violation | ||
|
||
Dafny program verifier finished with 0 verified, 2 errors | ||
Counterexample for first failing assertion: | ||
git-issue-2026.dfy(5,0): initial state: | ||
n : int = 5854 | ||
ret : ? = () | ||
git-issue-2026.dfy(6,24): | ||
Please enable /proverOpt:O:model_compress=false, otherwise you'll get unexpected values. | ||
n : int = 5854 | ||
ret : ? = ([null] := @0) | ||
@0 : ? = () | ||
git-issue-2026.dfy(8,14): | ||
Please enable /proverOpt:O:model_compress=false, otherwise you'll get unexpected values. | ||
n : int = 5854 | ||
ret : ? = ([null] := @0) | ||
i : int = 0 | ||
@0 : ? = () | ||
git-issue-2026.dfy(9,4): after some loop iterations: | ||
n : int = 5854 | ||
ret : ? = () | ||
i : int = 0 | ||
git-issue-2026.dfy(15,27): | ||
Please enable /proverOpt:O:model_compress=false, otherwise you'll get unexpected values. | ||
n : int = 5854 | ||
ret : ? = ([null] := @0) | ||
i : int = 0 | ||
@0 : ? = () | ||
git-issue-2026.dfy(19,18): | ||
Please enable /proverOpt:O:model_compress=false, otherwise you'll get unexpected values. | ||
n : int = 5854 | ||
ret : ? = ([null] := @0) | ||
i : int = 1 | ||
@0 : ? = () |