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

Disallow use of ghost members in non-ghost code #37

Closed
viper-admin opened this issue Jun 19, 2020 · 2 comments · Fixed by #771
Closed

Disallow use of ghost members in non-ghost code #37

viper-admin opened this issue Jun 19, 2020 · 2 comments · Fixed by #771
Labels

Comments

@viper-admin
Copy link
Member

Created by @ArquintL on 2020-06-19 09:45

I’ve observed that the following code snippet successfully verifies with Gobra. However, in my opinion this should only work if h is marked as a ghost variable.

package main

type Rectangle struct {
    Width, Height int
}

ghost
requires acc(r.Height)
ensures acc(r.Height)
pure func GetHeight(r *Rectangle) (res int) {
    return r.Height
}

func main() {
    r! := Rectangle{Width: 2, Height: 5}
    h := GetHeight(&r)
    assert h == GetHeight(&r) && h == 5
}

@viper-admin viper-admin added enhancement New feature or request minor labels Sep 16, 2020
@Felalolf
Copy link
Contributor

Here is another example from Peter.
anotherExample.txt

@ArquintL
Copy link
Member

ArquintL commented Feb 4, 2022

This issue might have been fixed by #239

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants