Some function allocatedness test are suppressed #1120
Labels
during 3: execution of incorrect program
An bug in the verifier that allows Dafny to run a program that does not correctly implement its spec
introduced: 2.0.0
kind: bug
Crashes, unsoundness, incorrect output, etc. If possible, add a `part:` label
part: verifier
Translation from Dafny to Boogie (translator)
priority: not yet
Will reconsider working on this when we're looking for work
A first-class function value
f
(like a lambda expression or an unapplied member function) can have a body that dereferences the heap, even iff
has an emptyreads
clause. In particular, this can happen if the body contains an expressionc.k
wherec
is a reference andk
is aconst
field. Consequently,f
should be allowed to be applied only in states where thatc
is allocated. This is not properly enforced.Thoughts about a solution
The current axiomatization says that a function
f
is allocated in a stateH
iffTo be correct, the "or" in the previous definition must also include any reference in
f
's body used to obtain the value ofconst
field. Since such references are not included in the functionsreads
clause (and for a good reason), the only recourse may be to disallow apply-expressions inside anyold
expression. This could be accomplished by changing the "iff" in the definition above to "only if" (that is, "implies") (changingBplIff
toBplImp
on line 9129 of Translator.cs).A more permissive solution would be to use not just the reads set of a function, but also a (new) "root set". The root set of a lambda function consists of the free local variables of a lambda expression, and consists of the receiver argument to an instance member function. Then, change or "or" part of the definition above to "every reference in
f
's read set or root set inH
is allocated inH
". The addition of such a root set would have an effect on the equality of functions. One may also want to expose some syntax for talking about root sets in specifications.Simple repros
Here are two simple cases that show the problem:
Additional test cases
The text was updated successfully, but these errors were encountered: