B6013: a function over an enclave's cells recursed deeper than there are cells
Catalog status: active. Default severity: error. Stable name: fuel-exhausted. Family: Ownership and finalization.
The heap engine does not prove that a proof enclave's recursive functions over its cells terminate: a structure walked by recursion ends only if its pointers do not form a cycle. Such functions run on fuel instead: a call of one may be nested at most as deep as there are heap objects, with a small margin, so a structure that a mistake made cyclic stops the program with this failed check, often in the type's invariant, instead of recursing until the stack runs out. This is a run-time check. (Such functions need no Subprogram_Variant, B5108.)
Example (Vada)
function Length_From (N : Node_Ptr) return Natural is
(if N = null then 0 else Natural'Min (Length_From (N.Next), 1000) + 1);
procedure Push (R : in out Ring; X : Integer) is
N : Node_Ptr := new Node'(Value => X, Next => R.Head);
begin
N.Next := N; -- a cycle: Length_From never reaches null
R.Head := N;
end Push;What to do (Vada)
Find where the structure became cyclic (here N.Next := N, which should be N.Next := R.Head); the type's invariant, checked at the operation's exit, is usually where the cycle is first walked.
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See ownership and finalization, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.