File tree 1 file changed +30
-0
lines changed
src/test/resources/all/issues/silicon
1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change
1
+ // Any copyright is dedicated to the Public Domain.
2
+ // http://creativecommons.org/publicdomain/zero/1.0/
3
+
4
+ field f: Int
5
+
6
+ predicate Mem(x: Ref)
7
+ {
8
+ acc(x.f) && 0 <= x.f
9
+ }
10
+
11
+ function recurse(x: Ref, idx: Int): Int
12
+ requires acc(Mem(x), wildcard)
13
+ requires unfolding acc(Mem(x), wildcard) in 0 <= idx && idx <= x.f
14
+ decreases unfolding acc(Mem(x), wildcard) in x.f - idx
15
+ {
16
+ unfolding acc(Mem(x), wildcard) in idx == x.f ? 42 : recurse(x, idx + 1)
17
+ }
18
+
19
+ method fooUnsound(x: Ref)
20
+ requires Mem(x)
21
+ ensures Mem(x)
22
+ //:: ExpectedOutput(postcondition.violated:assertion.false)
23
+ ensures false // succeeds unexpectedly
24
+ {
25
+ var oldResult: Int := recurse(x, 0)
26
+ unfold Mem(x)
27
+ x.f := x.f + 1
28
+ fold Mem(x)
29
+ var newResult: Int := recurse(x, 0) // this call triggers the unsoundness
30
+ }
You can’t perform that action at this time.
0 commit comments