DEVELOPMENT EDITION · 769442725406
Diagnostics Reference
On this page

B3027: procedure that changes nothing its caller sees

Catalog status: active. Default severity: warning. Stable name: no-effect. Family: Flow and effects.

A warning from flow analysis: the procedure has no out or in out parameter, writes no global, and propagates no exception, so a call of it does nothing its caller can observe (GNATprove's "subprogram has no effect"). The main program, a package's elaboration, task bodies, protected operations, ghost procedures and a body that is only null are not reported.

Example (Vada)

procedure Square (X : Integer) is
   Y : Integer;
begin
   Y := X * X;   --  computed, then lost (and B3025)
end Square;

Example (Varc)

fn square(x: Integer) {
    var y: Integer = x * x;   // computed, then lost
}

What to do

Give the result to the caller (an out parameter, or make it a function), write the global it was meant to change, mark it Ghost if it only states facts for proof, or remove it.

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.