You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
this is not fresh and fresh in well-formedness #4700
class A {
constructor()
}
class Test {
var x: A
constructor()
ensures fresh(this.x)
ensures foo()
{
x := new A();
}
}
predicate foo()
requires false
ensures false
{ true }
method Main() {
var t := new Test();
assert false;
}
We can see that we both assume that this is allocated, in the precondition of the procedure, while we also assume that it is not with the fresh. It seems like perhaps we consider the object to be allocated sooner than we should?
Consequently, it really seems like a verifier problem rather than a logical one.
The where clause of parameter this in the CheckWellFormed$$ procedure for Dafny constructors should not include $IsAlloc(this, Tclass._module.Test(), $Heap). In fact, we should make this be an out-parameter of such procedures, just like it is for the corresponding Impl$$ procedures.
The Call$$ procedure declares this to be an out-parameter and includes $IsAlloc(this, ...). That's fine for Call$$ (but not for CheckWellFormed$$ and Impl$$.
That seems like it should be relatively straightforward to fix. Would you agree, @jtristan and @RustanLeino? And do you think that, with the understanding that you have in mind, either of you would be up for trying to implement a fix?
Activity
jtristan commentedon Oct 20, 2023
jtristan commentedon Oct 20, 2023
Here is the relevant Boogie code:
We can see that we both assume that this is allocated, in the precondition of the procedure, while we also assume that it is not with the fresh. It seems like perhaps we consider the object to be allocated sooner than we should?
Consequently, it really seems like a verifier problem rather than a logical one.
RustanLeino commentedon Oct 20, 2023
The
whereclause of parameterthisin theCheckWellFormed$$procedure for Dafny constructors should not include$IsAlloc(this, Tclass._module.Test(), $Heap). In fact, we should makethisbe an out-parameter of such procedures, just like it is for the correspondingImpl$$procedures.The
Call$$procedure declaresthisto be an out-parameter and includes$IsAlloc(this, ...). That's fine forCall$$(but not forCheckWellFormed$$andImpl$$.atomb commentedon Oct 23, 2023
That seems like it should be relatively straightforward to fix. Would you agree, @jtristan and @RustanLeino? And do you think that, with the understanding that you have in mind, either of you would be up for trying to implement a fix?
Fix a soundness issue that could be triggered by calling ensures fres… (
atomb commentedon Mar 29, 2024
Given @RustanLeino's comment on #5248, I'm re-opening this.