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

Generated trigger by SimplifyNestedQuantifiers crashes Viper #1262

Open
superaxander opened this issue Oct 16, 2024 · 0 comments
Open

Generated trigger by SimplifyNestedQuantifiers crashes Viper #1262

superaxander opened this issue Oct 16, 2024 · 0 comments
Labels

Comments

@superaxander
Copy link
Member

In the following program:

//@ requires \pointer(a, n, write);
void foo(int *a,  int n) {
    int half = n/2;
    int *b = a + half;
    //@ assert \pointer(b - half, half, write);
    // becomes assert (\forall* int i=0..half; Perm(b - half + i, write));
    // becomes assert (\forall* int i=0..half; Perm({:ptrAdd(ptrAdd(b, -half), i):}, write));
}

The SimplifyNestedQuantifiers pass generates a trigger for the quantifier because -half is independent of i and therefore constant. But since this computation is not lifted out of the trigger (for example into a let expression) this causes viper to crash due to the invalid trigger. Ideally the resulting quantifier looks like this:

\forall* int i = 0..half; (\let int x = ptrAdd(b, -half); Perm({:ptrAdd(x, i):}), write)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant