Compliance with MISRA

The MISRA (Motor Industry Software Reliability Association) guidance is a software development standard that was created to facilitate best practices for programming safety-critical software in road vehicles and other embedded systems.

Simplifying MISRA Compliance with CodeSonar

The latest edition of the MISRA guidance brings substantial improvements from the previous standard, and organizations should switch to this version, if they haven't already, to prevent exposing their products and customers to considerable risk.

In the guidance, Rule 1.3 ("There shall be no occurrence of undefined or critical unspecified behavior.") and Directive 4.1 ("Run-time failures shall be minimized.") are of particular importance. Many of the most serious bugs in C arise from undefined behavior.

These bugs include:

  • Buffer overruns and underruns
  • Invalid pointer direction
  • Double close
  • Data races
  • Division by zero
  • Use of uninitialized memory

MISRA C recommends the use of an automated static analysis tool, such as CodeSonar, to find violations of the standard. All tools are not created equal, however, and some can only reason about superficial syntactic properties of the code. More advanced tools, like CodeSonar, have deep semantic knowledge of the entire program.

To this end, avoid lightweight static analysis tools, which can find syntactic violations but are generally not capable of finding the deeper defects. A clean report from a lightweight tool can give you a false sense of security because it will miss serious defects. Additionally, look for a tool that can find violations of the superficial syntactic rules as well as bugs such as the ones listed above.

The MISRA (Motor Industry Software Reliability Association) guidance is a software development standard that was created to facilitate best practices for programming safety-critical software in road vehicles and other embedded systems.


View the mapping of CodeSonar checks to MISRA rules: MISRA C 2004 | MISRA C 2012 | MISRA C++ 2008

How to Avoid Common Pitfalls in MISRA Compliance

Comply with coding standards faster.

Begin Your Free Trial