Axivion Dead Code Analysis | Quality Assurance (original) (raw)

How to Detect Dead and Unreachable Code with Axivion Static Code Analysis

Axivion Static Code Analysis detects code that does not get executed based on the following types analyses:

Axivion Static Code Analysis finds dead functions by means of a reachability analysis on the call relation (i.e. the interprocedural control flow) of the analysed software. These functions will never be called and therefore will never be executed because there are no connections from the program entry points of the system (e.g. from main, interrupt handlers or callbacks) to these functions.

By means of deeper programme analyses, code areas within individual functions that are statically inaccessible and inaccessible in terms of programme logic, can also be found (unreachable code, dead code, infeasible paths, unreachable statements, redundant catch blocks). These analyses are used by corresponding coding guidelines, for example by the MISRA rules. A simple example is code directly after a return statement. Another example is an else branch, which can never be traversed due to the variable values occurring in the conditions involved. Infinite loops can also be detected.

Do Not Let Dead Code Obscure Your View

Code that will not be executed still needs attention. Dead code complicates comprehensibility, testability and maintainability. Special attention should therefore be paid to areas that “die” due to changes made to the code in the development process. Ask yourself:

Here, the delta analysis of Axivion Static Code Analysis comes into play. Through this direct feedback, preventive bug fixes and low-threshold refactorings can be guided precisely.