Codeprover: all variables are unused
20 views (last 30 days)
Show older comments
Stein Heselmans
on 22 Feb 2018
Answered: Stein Heselmans
on 8 Mar 2018
I am running polyspace codeprover on our software project. It seems like all variables are reported to be unused. Looking at the html report (Developer template):
There exists no reachable operation on variable ‘xxx’.
This message is repeated for every variable that we have (or close to, i didn't check all of them). The entrypoints (option -entry-points) are copied from our bugfinder configuration (which nicely detects missing critical sections) and contains our interrupts and boot point. The function main() is not included as that one gets called from the boot point. But it seems like the while-loop that we have in main() does not get taken into account...
Our boot point is implemented in a crt0.S in assembler. From that assembler code we call C-functions which eventually lead to main() being executed. Is codeprover/bugfinder able to handle this target-specific assembler? And can it find the entrypoint for main()? Or does it implicitly assume main() is an entrypoint?
I always assumed our configuration for bugfinder was ok, but looking at the codeprover results, and writing this down, makes me think how bugfinder/codeprover can know the non-interrupt entrypoint main().
0 Comments
Accepted Answer
Alexandre De Barros
on 23 Feb 2018
Edited: Alexandre De Barros
on 23 Feb 2018
Hello,
If Polyspace Code Prover is able to find a function called main, it will automatically use it as the main entry point. By the way, Polyspace works with the C language only, so your assembly code is ignored/stubbed.
You are writing that you have a while loop in the main. That could be the explanation for the unreachable code. Indeed, with Code Prover (not Bug Finder) when the end of the main is unreachable, the entry-points (tasks, interrupts) are not "launched".
It means that you should see your entry-points in the list of unreachable functions in the dashboard (Code covered by verification).
And in this case, see this page to see what you have to do: https://www.mathworks.com/help/codeprover/ug/model-tasks-if-main-contains-infinite-loop.html
Best regards,
Alexandre
More Answers (1)
See Also
Categories
Find more on Bug Finder Analysis in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!