viperproject / chalice2silver

Other
0 stars 0 forks source link

mustTerminate encoding is unsound #84

Open viper-admin opened 8 years ago

viper-admin commented 8 years ago

Created by @vakaras on 2016-08-29 11:55

A method that has an obligation to terminate is allowed to call a non-terminating method as shown in the following example:

#!chalice
class A {
    method test_false_postcondition()
        ensures false;
    {
        while (true) {}
    }

    method test_false_postcondition_caller()
        requires mustTerminate(2);
    {
        //:: ExpectedOutput(assert.failed:assertion.false)
        //:: MissingOutput(assert.failed:assertion.false, /Chalice2Silver/issue/84/)
        call test_false_postcondition();
        assert false;
    }
}

The problem is that the encoding checks if called method picked the obligation to terminate after the call. However, if method's postcondition is false, then this check trivially succeeds.