Review and Fix Function Not Returning Value Checks
This topic describes how to systematically review the results of a Function not returning value check in Polyspace® Code Prover™.
Follow one or more of these steps until you determine a fix for the Function not
returning value check. For a description of the check and code examples,
see Function not returning value.
For the general workflow that applies to all checks, see Interpret Code Prover Results in Polyspace Desktop User Interface or Interpret Code Prover Results in Polyspace Access Web Interface (Polyspace Access).
Step 1: Interpret Check Information
Select the check on the Results List pane. The Result Details pane displays further information about the check.

You can see:
The immediate cause of the check.
In this example, the software has identified that a function with a non-
voidreturn type might not have areturnstatement.The probable root cause of the check, if indicated.
In this example, the software has identified that the check is possibly path-related. More than one call to the function exists, and the check is green on at least one call.
Step 2: Determine Root Cause of Check
Determine why a return statement does not
exist on certain execution paths.
Browse the function body for
returnstatements.If you find a
returnstatement:See if the
returnstatement occurs in a block inside the function.For instance, the
returnstatement occurs in anifblock. An execution path that does not enter theifblock bypasses thereturnstatement.See if you can identify the execution paths that bypass the
returnstatement.For instance, an
ifblock that contains thereturnstatement is bypassed for certain function inputs.If the function is called multiple times in your code, you can identify which function call led to bypassing of the
returnstatement. Use the option Sensitivity Context to determine the check color for each function call.
Possible fix: If the return type of the
function is incorrect, change it. Otherwise, add a return statement
on all execution paths. For instance,
if only a fraction of branches of an if-else if-else condition
have a return statement, add a return statement
in the remaining branches. Alternatively, add a return statement
outside the if-else if-else condition.