Why does Polyspace report a larger than expected number of execution paths in terms of the compute code metrics?
4 views (last 30 days)
Show older comments
MathWorks Support Team
on 2 Nov 2021
Commented: Anirban
on 2 Nov 2021
It is sought to verify the code snippet below using Polyspace Bug Finder and have the Code Metrics computed,
void myfun (void) {
while(1) {
if (1){
a = 10;
}
}
if (0) {
a++;
}
}
Knowing that the first nested control structure introducing three (3) execution paths and the second if-control structure introduces two (2) execution paths, I would expect tha the total number of execution paths that are reported in the Code Metrics of the Polyspace results is five (5).
However, the Number of Paths code metric of Polyspace reports six (6) execution paths in this case.
Why does Polyspace report a larger than expected number of execution paths in terms of the compute code metrics?
Accepted Answer
MathWorks Support Team
on 2 Nov 2021
Please note that subsequent control structures in a code have a multiplying and not an adding effect to the previously computed number of execution paths. Thus in this case the total number of execution paths is six (6).
1 Comment
More Answers (0)
See Also
Categories
Find more on Generate Reports in Polyspace Platform User Interface in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!