B8010: code no path reaches
Catalog status: active. Default severity: warning. Stable name: unreachable-code. Family: Warnings and assumptions.
A warning from proof, given only with --proof-warnings: the prover showed that no path reaches these statements. What is known where the branch starts (the subprogram's precondition, the conditions of the branches around it, what the statements before it establish) contradicts the branch's own condition. Each branch the program writes, of an if, a case or a loop's filter, is asked; a branch inside an unreachable one is not reported again, and nothing is reported in a subprogram whose precondition cannot hold (B8003 says so). A branch of a subprogram inlined at its calls is reported only when no call reaches it.
Example (Vada)
procedure Clamp (X : in out Integer) with Pre => X in 0 .. 100 is
begin
if X > 200 then
X := 200; -- B8010: X is at most 100 here
end if;
end Clamp;Example (Varc)
fn clamp(x: inout Integer)
requires x in 0 .. 100
{
if x > 200 {
x = 200; // B8010: x is at most 100 here
}
}
What to do
Remove the dead code, or, if it should run, correct the conditions that exclude it (the precondition may be stronger than intended).
Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See warnings and assumptions, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.