On this page
B3016: object with relaxed initialisation might be read before it is initialised
Catalog status: active. Default severity: error. Stable name: partly-initialised. Family: Flow and effects.
An object declared with Relaxed_Initialization may be initialised a part at a time, so flow analysis does not check it; instead the prover checks that every part that is read has been written. X'Initialized (or X (I)'Initialized) says that it has, in loop invariants and assertions. The prover found a read of a part that might not be initialised.
Example (Vada)
T : Table with Relaxed_Initialization;
...
T (1) := 1;
T (2) := T (1) + T (3); -- T (3) is not initialised yetExample (Varc)
var t: Table @Relaxed_Initialization;
...
t[1] = 1;
t[2] = t[1] + t[3]; // t[3] is not initialised yet
What to do (Vada)
Write the part before reading it, or state what is initialised in a loop invariant: pragma Loop_Invariant (for all J in T'First .. I => T (J)'Initialized);.
What to do (Varc)
Write the part before reading it, or state what is initialised in a loop invariant: invariant forall j in t::First..=i => t[j]::Initialized;.
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.