B5120: the program might exit where it may not, or its exit condition might not hold
Catalog status: active. Default severity: error. Stable name: program-exit. Family: Contracts and termination.
A call of a subprogram with Program_Exit (such as GNAT.OS_Lib.OS_Exit) may end the whole program there. Verada proves two things of every such call: that the subprogram making it may exit the program too (it has Program_Exit itself, or the call can never exit on that path), and that the caller's own Program_Exit condition holds when the program exits there. A main program that exits needs Program_Exit as well.
Example (Vada)
procedure Quit is
begin
GNAT.OS_Lib.OS_Exit (1);
end Quit;What to do (Vada)
Say that the procedure may exit the program, and what holds when it does:
procedure Quit
with Global => (In_Out => Done), Program_Exit => Done;
procedure Quit is
begin
Done := True;
GNAT.OS_Lib.OS_Exit (1);
end Quit;Regression source and further reading
Complete regression example: source, command arguments and expected results. The fixture deliberately reproduces this diagnostic.
See contracts and termination, the code index, and diagnostic interpretation for modes, replay, fix-its and JSON.