DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B2022: an enclave type crossing to foreign code, volatile or at an address

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

A proof enclave's types do not cross to the outside world: they do not appear in the profiles of imported or exported subprograms or of subprograms of a foreign convention, objects of them are not imported or exported, volatile or placed at an address, and their addresses are not taken. Foreign code could copy or keep the pointers inside them, and a volatile object or one at an address could be changed by something the enclave's proofs do not see. (Unchecked_Conversion converts scalar types only, and a general access value takes the object it designates under ownership, so neither is a way out.)

Example (Vada)

package Lists
  with Annotate => (Verada, Enclave)
is
   type List is limited private;
   procedure Show (L : List)
     with Import, Convention => C, External_Name => "show_list", Global => null;
   ...

What to do (Vada)

Give the foreign code what it needs by value: an operation of the enclave that copies the elements into an array, and import a subprogram that takes the array.

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.