-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix uses of heap parameter in verifier-translation of comprehension e…
…xpressions (#1166) * Use correct heap when defining frame for lambda expr * Fix crash Fixes #1163 * Add regression test * Make sure allocation tests are performed * Use correct heap throughout comprehension translation * Note that wish has been granted * Assume lambda-expr parameters are allocated on entry * Adjust for changes in error-path output
- Loading branch information
1 parent
3b5de79
commit 0ae4fc7
Showing
18 changed files
with
149 additions
and
36 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
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
File renamed without changes.
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,11 @@ | ||
regression-calc.dfy(8,16): Error: A postcondition might not hold on this return path. | ||
regression-calc.dfy(8,10): Related location: This is the postcondition that might not hold. | ||
Execution trace: | ||
(0,0): anon0 | ||
regression-calc.dfy(9,5): anon2_Else | ||
regression-calc.dfy(15,16): Error: A postcondition might not hold on this return path. | ||
regression-calc.dfy(15,10): Related location: This is the postcondition that might not hold. | ||
Execution trace: | ||
(0,0): anon0 | ||
|
||
Dafny program verifier finished with 0 verified, 2 errors |
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,66 @@ | ||
// RUN: %dafny /compile:0 "%s" > "%t" | ||
// RUN: %diff "%s.expect" "%t" | ||
|
||
function F(i: int): int | ||
|
||
method M() { | ||
ghost var f := old(i => F(i)); // the translation of this once had crashed the verifier | ||
} | ||
|
||
class MyClass { | ||
var y: int | ||
|
||
method N() | ||
modifies this | ||
{ | ||
y := 8; | ||
label L: | ||
var p := new MyClass; | ||
label K: | ||
if * { | ||
ghost var g := old@L((x: int) reads p.R(this) => x); // error, because p is not allocated in L | ||
} else if * { | ||
ghost var g := old@L((x: int) reads R(p) => x); // error, because p is not allocated in L | ||
} else if * { | ||
ghost var g := old@K((x: int) reads p.R(p) => x); | ||
} else { | ||
ghost var g := old((x: int) reads p.R(p) => x); // error, because p is not allocated in old state | ||
} | ||
} | ||
|
||
method O() | ||
modifies this | ||
{ | ||
y := 8; | ||
label L: | ||
ghost var h := | ||
old@L( | ||
(p: MyClass) requires p.y == 10 reads p => | ||
assert p.y == 10; 5 // this assert once didn't work, because of a mismatch of heap variables in the translator | ||
); | ||
} | ||
|
||
method Q() | ||
modifies this | ||
{ | ||
// The following uses of p in R(p) should be allowed. In particular, they should not | ||
// produce "p not allocated in function state" errors. | ||
if * { | ||
ghost var h := old((p: MyClass) reads R(p) => 5); | ||
} else if * { | ||
ghost var s := old(iset p: MyClass | R(p) == p); | ||
} else if * { | ||
ghost var m := old(imap p: MyClass | R(p) == p :: 12); | ||
} else if * { | ||
ghost var m := old(var p: MyClass :| R(p) == p; p.y); | ||
} else { | ||
ghost var m := old(forall p: MyClass :: R(p) == p); | ||
} | ||
} | ||
|
||
function R(c: MyClass): MyClass | ||
reads this | ||
{ | ||
this | ||
} | ||
} |
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,20 @@ | ||
git-issue-1163.dfy(21,42): Error: receiver argument must be allocated in the state in which the function is invoked | ||
Execution trace: | ||
(0,0): anon0 | ||
(0,0): anon23_Then | ||
(0,0): anon24_Then | ||
(0,0): anon25_Then | ||
git-issue-1163.dfy(23,44): Error: argument must be allocated in the state in which the function is invoked | ||
Execution trace: | ||
(0,0): anon0 | ||
(0,0): anon26_Then | ||
(0,0): anon27_Then | ||
(0,0): anon28_Then | ||
git-issue-1163.dfy(27,40): Error: receiver argument must be allocated in the state in which the function is invoked | ||
Execution trace: | ||
(0,0): anon0 | ||
(0,0): anon29_Else | ||
(0,0): anon32_Then | ||
(0,0): anon33_Then | ||
|
||
Dafny program verifier finished with 3 verified, 3 errors |
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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
git-issue-405.dfy(19,22): Error: insufficient reads clause to read field | ||
Execution trace: | ||
(0,0): anon0 | ||
(0,0): anon7_Then | ||
(0,0): anon8_Then | ||
|
||
Dafny program verifier finished with 6 verified, 1 error |
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
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 was deleted.
Oops, something went wrong.