SA0022: (Possibly) unassigned return value

Detects all functions and methods that include an execution thread without an assignment to the return value

Justification: An unassigned return value in a function or method is an indication of missing code. Even if the return value always has a default value, it is always useful to assign it again explicitly to avoid confusion.

Importance: Medium

Example

FUNCTION FUN : DINT
VAR_INPUT
        bTest : BOOL;
END_VAR

IF bTest THEN
        RETURN;
END_IF
FUN := 99;

--> SA0022:  Möglicherweise nicht zugewiesene Rückgabewerte