-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add bug witness * add fix * feedback from Felix
- Loading branch information
Showing
2 changed files
with
93 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Any copyright is dedicated to the Public Domain. | ||
// http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
package issues | ||
|
||
preserves acc(x) | ||
ensures *x == old(*x) + 1 | ||
ensures !res | ||
func incF(x *int) (res bool) { | ||
*x += 1 | ||
return false | ||
} | ||
|
||
func clientAnd1() { | ||
x@ := 1 | ||
if incF(&x) && incT(&x) { | ||
assert false | ||
} | ||
assert x == 2 | ||
} | ||
|
||
func clientAnd2() { | ||
x@ := 1 | ||
if incT(&x) && incT(&x) {} | ||
assert x == 3 | ||
} | ||
|
||
preserves acc(x) | ||
ensures *x == old(*x) + 1 | ||
ensures res | ||
func incT(x *int) (res bool) { | ||
*x += 1 | ||
return true | ||
} | ||
|
||
func clientOr1() { | ||
x@ := 1 | ||
if incT(&x) || incT(&x) {} | ||
assert x == 2 | ||
} | ||
|
||
func clientOr2() { | ||
x@ := 1 | ||
if incF(&x) || incT(&x) {} | ||
assert x == 3 | ||
} |