Main Content

Reviewing Code Prover Run-Time Checks

Polyspace® Code Prover™ checks each operation in your C/C++ code for certain run-time errors and displays the result as a red, green or orange check. For more information, see Code Prover Result and Source Code Colors.

You must review a red or orange check and determine whether to fix your code. The tables below list the checks that Polyspace Code Prover performs and how you can review them.

Data Flow Checks

The following table outlines how to review the results of some of the data flow checks in Code Prover.

CheckHow to ReviewDetails
Function not called

Investigate why a function does not appear in the call graph starting from the main or another entry point function.

Review and Fix Function Not Called Checks
Function not reachable

Identify the call sites of a function and investigate why they occur in unreachable code.

Review and Fix Function Not Reachable Checks
Non-initialized local variable

Locate prior variable initializations if any and see if your program can bypass them.

Review and Fix Non-initialized Local Variable Checks
Non-initialized pointer

Locate prior pointer initializations if any and see if your program can bypass them.

Review and Fix Non-initialized Pointer Checks
Non-initialized variable

Locate prior initializations of the global variable if any and see if your program can bypass them.

Review and Fix Non-initialized Variable Checks
Return value not initialized

Identify paths through your function body that do not end in a return statement.

Review and Fix Return Value Not Initialized Checks
Unreachable code

Investigate why a conditional statement in your code is redundant, for instance, always true or always false.

Review and Fix Unreachable Code Checks

Numerical Checks

The following table outlines how to review the results of some of the numerical checks in Code Prover.

CheckHow to ReviewDetails
Division by zero

Review prior operations in your code that lead to zero value of a denominator.

Review and Fix Division by Zero Checks
Invalid shift operations

Review prior operations in your code that lead to a shift amount outside bounds or a negative value being left-shifted.

Review and Fix Invalid Shift Operations Checks
Overflow

Review prior operations in your code that lead to an operation overflowing.

Review and Fix Overflow Checks

Static Memory Checks

The following table outlines how to review the results of some of the static memory checks in Code Prover.

CheckHow to ReviewDetails
Absolute address usage

Review uses of absolute address in your code and make sure that the addresses are valid.

Review and Fix Absolute Address Usage Checks
Illegally dereferenced pointer

Review prior operations in your code that lead to a pointer pointing outside its allocated memory buffer.

Review and Fix Illegally Dereferenced Pointer Checks
Out of bounds array index

Review prior operations in your code that lead to an array index being greater than or equal to array size.

Review and Fix Out of Bounds Array Index Checks

Control Flow Checks

The following table outlines how to review the results of some of the control flow checks in Code Prover.

CheckHow to ReviewDetails
Non-terminating call

Review operations in the function body and find which run-time error occurs because of issues specific to the current function call.

Review and Fix Non-Terminating Call Checks
Non-terminating loop

Review operations in the loop and determine why the loop does not terminate or why a definite run-time error occurs in one of the loop runs.

Review and Fix Non-Terminating Loop Checks

C++ Checks

The following table outlines how to review the results of some of the C++-specific checks in Code Prover.

CheckHow to ReviewDetails
Invalid C++ specific operations

Determine root cause of nonpositive array size or incorrect usage of the typeid or the dynamic_cast operator.

Review and Fix Invalid C++ Specific Operations Checks
Function not returning value

Identify paths through your function body that do not end in a return statement.

Review and Fix Function Not Returning Value Checks
Incorrect object oriented programming

Investigate why a certain virtual member call or this pointer usage represents an incorrect pattern of object oriented programming.

Review and Fix Incorrect Object Oriented Programming Checks
Null this-pointer calling method

Investigate why the pointer to the current object can be NULL-valued.

Review and Fix Null This-pointer Calling Method Checks
Uncaught exception

Investigate how an exception can escape uncaught from the function where it is thrown.

Review and Fix Uncaught Exception Checks

Other Checks

The following table outlines how to review the results of some of the uncategorised checks in Code Prover.

CheckHow to ReviewDetails
Correctness condition

Find the root cause of a function pointer misuse, incorrect array conversion or variable values outside specified constraints.

Review and Fix Correctness Condition Checks
Invalid use of standard library routine

Investigate why the arguments in the current call to the standard library routine are invalid.

Review and Fix Invalid Use of Standard Library Routine Checks
User assertion

Investigate why the condition in an assert statement fails.

Review and Fix User Assertion Checks

Related Topics