-
Notifications
You must be signed in to change notification settings - Fork 40
Not pushing conditions using permission introspection further in #853
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
marcoeilers
merged 4 commits into
master
from
meilers_cond_perms_disable_for_perm_introspection
Jun 17, 2024
Merged
Changes from 3 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
19 changes: 19 additions & 0 deletions
19
src/test/resources/conditionalizePermissions/carbon_0179.vpr
This file contains hidden or 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,19 @@ | ||
| // Any copyright is dedicated to the Public Domain. | ||
| // http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
| predicate P1(r$: Ref) | ||
|
|
||
| predicate P3(r$: Ref) | ||
|
|
||
| method test2() | ||
| { | ||
| var b: Ref | ||
| var k: Perm | ||
|
|
||
| inhale acc(P1(b)) | ||
| inhale acc(P3(b)) | ||
|
|
||
| exhale perm(P3(b)) >= write ? acc(P3(b)) : (perm(P1(b)) > none ? acc(P1(b), write - perm(P3(b))) : true) | ||
|
|
||
| assert perm(P1(b)) == write | ||
| } |
This file contains hidden or 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,15 @@ | ||
| // Any copyright is dedicated to the Public Domain. | ||
| // http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
| field f: Int | ||
|
|
||
| function ok(): Bool | ||
|
|
||
|
|
||
| function val(): Ref | ||
| requires ok() | ||
|
|
||
| method test() | ||
| { | ||
| inhale ok() ==> let x == (val()) in acc(x.f) | ||
| } | ||
15 changes: 15 additions & 0 deletions
15
src/test/resources/conditionalizePermissions/silicon_0008.vpr
This file contains hidden or 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,15 @@ | ||
| // Any copyright is dedicated to the Public Domain. | ||
| // http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
|
|
||
| field f: Int | ||
|
|
||
| method deAlias(x: Ref, y: Ref, k: Perm) | ||
| requires k >= none | ||
| requires acc(x.f, k) && acc(y.f, k) | ||
| // The following postcondition should fail in default greedy Silicon because --conditionalizePermissions creates a | ||
| // situation where the two chunks may or may not alias in the same branch, so they cannot definitively be merged, | ||
| // so greedy Silicon cannot prove the postcondition using any individual chunk. | ||
| //:: ExpectedOutput(postcondition.violated:insufficient.permission) | ||
| ensures x == y ==> acc(x.f, 2 * k) | ||
|
jcp19 marked this conversation as resolved.
|
||
| {} | ||
27 changes: 27 additions & 0 deletions
27
src/test/resources/conditionalizePermissions/silicon_0713.vpr
This file contains hidden or 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,27 @@ | ||
| // Any copyright is dedicated to the Public Domain. | ||
| // http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
|
|
||
| field int: Int | ||
| field unrelated: Int | ||
|
|
||
| method conv_layer(a: Set[Ref]) | ||
| requires (forall r: Ref :: r in a ==> acc(r.int, write)) | ||
| { | ||
| label beforeFrame | ||
| while (true) | ||
| invariant true ==> | ||
| (forall r: Ref :: r in a ==> acc(r.int, write)) && | ||
| [ | ||
| // on inhale | ||
| (forperm | ||
| obj: Ref [obj.unrelated] :: obj.unrelated == | ||
| old[beforeFrame](obj.unrelated)) && | ||
| (forperm | ||
| obj: Ref [obj.int] :: obj.int == old[beforeFrame](obj.int)), | ||
|
|
||
| // on exhale | ||
| true | ||
| ] | ||
| { inhale false } | ||
| } |
This file contains hidden or 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,16 @@ | ||
| // Any copyright is dedicated to the Public Domain. | ||
| // http://creativecommons.org/publicdomain/zero/1.0/ | ||
|
|
||
| field f: Int | ||
|
|
||
| function ok(): Bool | ||
|
|
||
|
|
||
| function val(): Ref | ||
| requires ok() | ||
|
|
||
|
|
||
| method test() | ||
| { | ||
| inhale ok() ==> acc(val().f) | ||
| } |
15 changes: 15 additions & 0 deletions
15
src/test/scala/SiliconTestsConditionalizePermissions.scala
This file contains hidden or 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,15 @@ | ||
| // This Source Code Form is subject to the terms of the Mozilla Public | ||
| // License, v. 2.0. If a copy of the MPL was not distributed with this | ||
| // file, You can obtain one at http://mozilla.org/MPL/2.0/. | ||
| // | ||
| // Copyright (c) 2011-2022 ETH Zurich. | ||
|
|
||
| package viper.silicon.tests | ||
|
|
||
| class SiliconTestsConditionalizePermissions extends SiliconTests { | ||
| override val testDirectories: Seq[String] = Seq("conditionalizePermissions") | ||
|
|
||
| override val commandLineArguments: Seq[String] = Seq( | ||
| "--timeout", "300" /* seconds */, | ||
| "--conditionalizePermissions") | ||
| } | ||
|
marcoeilers marked this conversation as resolved.
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.