gradual-verification / gvc0

Gradually Verified C0
6 stars 5 forks source link

Permissions not being reinitialized before call to imprecise method in precise context (BST) #25

Closed icmccorm closed 2 years ago

icmccorm commented 2 years ago

Running the checked partial spec #156/157 of BST at workload 2 leads to the following trace:

286: main()
            |- 344: tree_remove()
                            |-  623: tree_remove_helper()
                                             |- 730: tree_remove_lemma_left()

Both tree_remove and tree_remove_helper are complete and precise, but tree_remove_lemma_left is imprecise. When looking at the code with runtime checks inserted, tree_remove_lemma_left is being passed an empty OwnedFields struct; we aren’t doing anything to recreate the permissions at the call site, so the first runtime check in tree_remove_lemma_left fails immediately. The precondition for tree_remove_lemma_left is:

//@requires ? && bst(l, min, max) && max < x;

So we should be adding the permissions for bst to OwnedFields. To recreate this issue, verify the included partial spec and run with workload 2, or directly compile the checked version, which has the correct workload value hard coded. Line numbers in the trace above refer to the checked version/verifier output.