MATLAB: Do I get “Not computed” values for Code Complexity Metrics: Program Stack Usage using Polyspace Code Prover Access R2020a

computednotPolyspace Code Proverprogramstackusage

In Polyspace code prover, I would like to determine the Code Complexity Metrics "Program Maximum Stack Usage" and "Program Minimum Stack Usage".
I have used the '-code-metrics' option and also activated the checkers PROG_MAX_STACK and PROG_MIN_STACK, but still I am not able to see the corresponding metrics in my Access dashboard.
(In the result list I can find stack usage values for functions but I get "Not computed" at project level.)
The code project has no 'open' run-time red checks, so I don't understand why the value is not calculated.
I had one red check related to infinite loop, but I've justified it as it is an intended loop used to manage background task.

Best Answer

If the stack size usage is *"Not computed" *there are 3 common reasons:
  • Please, check whether the function or its callee contains a red check (definite run-time error). If yes, the error has to be fixed. If your program contains a red check, you do not see this metric. The reason is that code following a red check is not analyzed. If that code contains function calls, any metric value shown would be inaccurate.
  • Even if there are any intentional infinite loops like while(1) { } or a red loop that was justified, these would prevent this metrics from being calculated as well.
  • You also do not see this metric if your code has calls to recursive functions. Please, check whether the function or its callee contains a call to a recursive function. Please, also be aware that this is the case, if there is a potential recursion (if the recursion could be avoided with certain conditions)
In order to spot places where recursion is used, you might turn on the following MISRA checker "MISRA C:2012 Rule 17.2" and check the results for Coding Rule Violations.
Please refer the below link for more documentation: