DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B3013: ghost entity used in code that is compiled

Catalog status: active. Default severity: error. Stable name: ghost-in-code. Family: Flow and effects.

Ghost variables and subprograms exist for proof and are normally erased in strict and proof-disabled compilation. Advisory compilation can retain them for applicable runtime checks; that does not permit ghost data to affect ordinary executable results. They may be used in contracts, assertions and ghost statements (assignments to ghost variables, calls of ghost procedures), but not in code that is compiled, or the program would behave differently without them.

Example (Vada)

   Steps : Natural := 0 with Ghost;
   ...
   Count := Steps;   --  a normal variable gets a ghost value

Example (Varc)

    ghost var steps: Natural = 0;
    ...
    count = steps;   // a normal variable gets a ghost value

What to do (Vada)

Use the ghost entity only in proof, or remove Ghost if the program needs the value.

What to do (Varc)

Use the ghost entity only in proof, or remove ghost if the program needs the value.

Regression source and further reading

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

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