Skip to content
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

Branching re-borrow causes permission error #25

Closed
frececroka opened this issue Apr 30, 2020 · 0 comments · Fixed by #740
Closed

Branching re-borrow causes permission error #25

frececroka opened this issue Apr 30, 2020 · 0 comments · Fixed by #740
Labels
bug Something isn't working

Comments

@frececroka
Copy link
Contributor

This can be verified:

extern crate prusti_contracts;

struct Point { x: u32, y: u32 }

fn f1<'a>(p: &'a mut Point) -> &'a mut u32 {
	if p.x == 0 {
		&mut p.x
	} else {
		&mut p.x
	}
}

This fails with an internal encoding error:

extern crate prusti_contracts;

struct Point { x: u32, y: u32 }

fn f1<'a>(p: &'a mut Point) -> &'a mut u32 {
	if p.x == 0 {
		&mut p.y
	} else {
		&mut p.x
	}
}

The error is internal encoding error - unregistered verification error: [unfold.failed:insufficient.permission] Unfolding u32(old[post](_1.val_ref).f$x) might fail. There might be insufficient permission to access old[post](_1.val_ref).f$x. (<no position>)

The problem seems to be that the predicates are not folded/unfolded correctly. I managed to get it to work by inserting/removing some folds/unfolds manually. The file main-fail.rs.vpr is the Viper encoding generated by Prusti and the file main-succeed.rs.vpr contains my modifications.

@fpoli fpoli added the bug Something isn't working label May 6, 2020
@cmatheja cmatheja closed this as completed Mar 1, 2021
@Aurel300 Aurel300 reopened this Mar 1, 2021
fpoli added a commit that referenced this issue Nov 2, 2021
fpoli added a commit that referenced this issue Nov 2, 2021
@fpoli fpoli closed this as completed in #740 Nov 2, 2021
zgrannan added a commit to zgrannan/prusti-dev that referenced this issue Nov 27, 2023
* Introduce ExprKind

* Refactor

* Format
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants