Open Pointerbender opened 3 years ago
Actually, #710 fixes a variant of this issue. I still get the errors described above.
@fpoli Only one of the two consistency errors was fixed by my PR :) There are also some other instances related to the same root cause, @vakaras is currently contemplating how to best fix all of those in one go. I'll see if I can draft up some more regression tests this weekend in order to capture all the edge cases (off the top of my head, these are: array repeat expression initialization, array direct assignment, array lookup, array slicing (shared/mutable), probably the same operations for slices, too - I will double check with the code base this weekend to see if I missed any in the list of use cases).
Just a quick update to summarize the latest activity on this issue: there are now 11 test cases in prusti-tests/tests/verify_partial/fail/issues
which reproduce the errors mentioned in this issue (or different related variants thereof). Once the underlying cause is fixed, these test cases can be moved to prusti-tests/tests/verify_overflow/pass/issues
to be re-used as regression tests.
It looks like one of the 11 test cases (prusti-tests/tests/verify_partial/fail/issues/issue-709-13.rs
) will be fixed soon as a bonus side effect of #603 :) It can then be moved to the pass
folder instead.
Hi again! I've found another
Consistency error: expected the same type, but got Snap$m_A$_beg_$_end_ and Ref
error and it's similar to #707. This time it's in the context of arrays. This program triggers two consistency errors:The first one is due to an
inhale
statement where the left-hand side is snapshot encoded, but the right-hand side is not:The second one has the same problem, but performs a modifying lookup through a temporary variable:
My first guess that this is due to missing snapshot encoding logic in
ProcedureEncoder::encode_assign_array_repeat_initializer()
andProcedureEncoder::encode_array_lookup_mut()
inprusti-viper/src/encoder/procedure_encoder.rs
.After seeing the
return_type.is_snapshot() || return_type.is_domain()
fixes in #693 and #707, I was hoping to try my hand to add the same quick fix here. However, this time it is slightly different, in that the bug now lies on the right-hand side and seems present in multiple places (perhaps also in otherProcedureEncoder::encode*{array|slice}*()
methods or inprusti-viper/src/encoder/array_encoder.rs
?) and that I have not (yet) found any existing snapshot encoding calls for the right-hand side which I can extend with the same fix (sometimes Prusti complains that the corresponding pre-conditions go missing, because I'm currently not sure how to generate the "pre-statements"). I'm eager to try more, although I might need a little mentoring on this one :smile: (I have read Johannes Schilling's master thesis "Specifying and Verifying Sequences and Array Algorithms in a Rust Verifier", which seems to touch on this part of the code, in case that helps - although a friendly disclaimer: I'm still very new to formal verification in general :smile: ). Going to send a first PR that hopefully addressesProcedureEncoder::encode_assign_array_repeat_initializer()
shortly!