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

"unfold" in pure method is silently dropped #1257

Open
ArmborstL opened this issue Oct 9, 2024 · 0 comments
Open

"unfold" in pure method is silently dropped #1257

ArmborstL opened this issue Oct 9, 2024 · 0 comments
Labels
A-Bug F-all Frontend: all

Comments

@ArmborstL
Copy link
Contributor

When marking a C procedure as pure, one can add a unfold statement like below:

/*@ pure*/ int size(struct node *list) {
    if(list==NULL) return 0;
    else return 1+/*@ with unfold state(list);*/size(list->next);
}

This parses fine, so I'd expect that the with unfold gets translated to an unfolding. In reality, it is just dropped; the viper output is

(some(nothingAs1(optGet1((none1(): Option[Nothing])))): Option[Pointer])) ?
    0 :
    1 + size1(ptrDeref(ptrAdd(optGet2(list), 0)).ref.next))

Consequently, VerCors reports There may be insufficient permission to dereference the pointer for the list->next.

The with unfold should either be translated into unfolding, or explicitly disallowed.

@ArmborstL ArmborstL added A-Bug F-all Frontend: all labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Bug F-all Frontend: all
Projects
None yet
Development

No branches or pull requests

1 participant