DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B2026: X'Old as the argument of a function over an enclave's cells

Catalog status: active. Default severity: error. Stable name: enclave-old-argument. Family: Types and constraints.

Inside a proof enclave, a function over its cells (such as Model, or any function whose parameter holds the enclave's pointers) reads the cells as they are when it is called. In a postcondition, F (X'Old) therefore means "F of X's value on entry, applied to the cells as they are now", which is rarely what is meant and which the heap engine does not prove: it proves an enclave's contracts with such functions applied to whole states. F (X)'Old, the call's value on entry, is what such a postcondition says.

Example (Vada)

   procedure Bump (C : in out Counter)
     with Post => Value (C) = Value (C'Old) + 1;

What to do (Vada)

Apply 'Old to the whole call:

   procedure Bump (C : in out Counter)
     with Post => Value (C) = Value (C)'Old + 1;

Regression source and further reading

Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.

See types and constraints, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.