Closed btj closed 5 years ago
Reducing this problem is non-trivial: the issue does not occur when:
-target 32bit
create_queue
and enqueue
ctxt#assert_term
call in get_fresh_integer_type_limits_symbols
in verifast1.ml
The issue also does not occur when running with -prover ext_z3
instead of -prover z3v4.5
.
Running
verifast -prover z3v4.5+SMTLib ../examples/shared_boxes/concurrentqueue.c
produces
../examples/shared_boxes/concurrentqueue.c
Error: Sorts inductive and Int are incompatible
but then running
z3 -v:1 auto_config=false smt.mbqi=false model=false type_check=true well_sorted_check=true -smt2 z3_v4dot5_dump.smt2
produces
[...]
unknown
where z3_v4dot5_dump.smt2
ends in
; Query: (= I32 malloc_block_queue)
(push)
(assert (not (= I32 malloc_block_queue)))
(check-sat)
(pop 1)
which I take to mean that the I == malloc_block_queue
query returns false
here.
The above outcomes were obtained when running against Z3 4.5.0. If I compile VeriFast with OCaml 4.07.1 and Z3 4.8.4 (through Opam), I still get Error: Sorts inductive and Int are incompatible
.
I could get the same error message by generating a replay log by inserting let 1 = Z3native.open_log "z3.log" in
immediately after the line class z3_context () =
in z3v4dot5prover.ml
, and then replaying it using z3 z3.log
.
I submitted a Z3 bug: https://github.com/Z3Prover/z3/issues/2244
It turns out that above, when I thought I was running against Z3 4.8.4, I was in fact still running against Z3 4.5.0. I was not able to reproduce the problem against Z3 4.8.4, so the fix for this issue seems to be to upgrade to Z3 4.8.4.
Since we have now moved to Z3 4.8.5, I am closing this issue.
Running
produces
While closing the box as part of executing the first
perform_action
statement oftry_dequeue
, VeriFast tries to consume the box invariant conjunctI(drop(index_of(head, nodes) + 1, vs))
. One of the heap chunks in the symbolic heap at that point ismalloc_block_queue(q)
. VeriFast first checks ifI == malloc_block_queue
. One would expect that this Z3 query returnfalse
, but here it returnstrue
.(In a next step, VeriFast compares the argument of the predicate assertion with the argument of the heap chunk. Since they are of different prover types, this produces a Z3 error. But the root cause is the fact that the initial Z3 query returns
true
.)