MATLAB Answers

Bug Finder analysis on Autogenerated Code

1 view (last 30 days)
Darshan Gade
Darshan Gade on 14 Jan 2021
Answered: Anirban on 15 Jan 2021
If we select High-Level Code Generation Objectives at the time of code generation using Embedded Coder to be a pure code with no defects, do we still need to go for bug finder\code prover polyspace verification. It make sense to run bug finder\Code prover analysis on handcode but what are the chances that generated code from simulink model will survive without polyspace (at least bug finder) verfication?
objective is to identify what will be missed if bug finder analysis is not performed on Autogenerated code.

Answers (1)

Anirban on 15 Jan 2021
Are you using all the High-Level Code Generation Objectives listed on this page? Are you also using a model verification tool?
Either way, the reason for still using Polyspace is that the generated code can lead to run-time errors because of design flaws in the model (something unrelated to the code generation process). A common example is a run-time error that occurs because some edge case input was not taken into account in the design and escaped testing. You need a static analysis tool such as Polyspace Code Prover to exhaustively check the generated code.
Also, you would need a tool that is independent from the code generation tool to ascertain for yourself or prove to a certification authority that the generated code is indeed free of defects. Static analysis with the Polyspace products provides this independent check.
If you want to see examples of problems that can happen in the generated code because of issues in the model itself, see this example Fix Model Design Issues Found as Bugs in Generated Code.


Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by