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

[generics] Can not find an exists chunk in the heap. #22

Open
necto opened this issue Apr 20, 2016 · 1 comment
Open

[generics] Can not find an exists chunk in the heap. #22

necto opened this issue Apr 20, 2016 · 1 comment

Comments

@necto
Copy link
Contributor

necto commented Apr 20, 2016

I use the exists<t>(_) mechanism to pass the type argument to a generic function. However I also need a t -> int fixpoint function which I also pass via the exists<fixpoint(t,int)> chunk.
To avoid confusion between the two, I merged them into exists<pair<t, fixpoint(t,int)> > and pass both a dummy t value and a function.
VeriFast fails to find this chunk, albeit it is visible in the heap panel in vfide.
Here is the code:

int calee/*@ <t> @*/()
//@ requires exists<pair<t, fixpoint(t,int)> >(pair(_, ?hsh));
//@ ensures true;
{
  return 0;
}

//@ fixpoint int idi(int x) { return x; }

int caller()
//@ requires true;
//@ ensures true;
{
  //@ close exists(pair(0, idi));
  calee();
}
@necto
Copy link
Contributor Author

necto commented Apr 21, 2016

The workaround here is to define a custom predicate, like:

//@ predicate type_arg<t>(t x, fixpoint(t,int) f) = true;

And use it instead of exists this seems to work.

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

No branches or pull requests

1 participant