Red checks are added when number of files are added

1 visualizzazione (ultimi 30 giorni)
My project has 10 modules . I fixed all the modules separately for red checks , now no red check is present .
But , when I run combine report for all 10 modules it shows me number of red checks specially "NTL - Non terminating Loop" in for loop .
Can someone help with why this behaviour is observed ?
  1 Commento
KSSV
KSSV il 17 Ago 2022
What is Red check?? Is it warning shown in the code? You need to elaborate the question.

Accedi per commentare.

Risposte (1)

Anirban
Anirban il 17 Ago 2022
Modificato: Anirban il 17 Ago 2022
I am not sure what you mean by running a combined report. Does it mean that you combined the source files in all modules and ran a Polyspace Code Prover analysis on this combination?
If this is the case, then I can show a simple illustration of how a red check can happen in the combined analysis. Let us say, module 1 has this file:
double reciprocal(int);
void foo(void) {
double sum = 0.0;
for(int ctr = -10; ctr <=10; ctr++){
sum+=reciprocal(ctr);
}
}
And module 2 has this file:
double reciprocal(int arg) {
return 1/arg;
}
Running Code Prover individually on each module will show only orange checks. But if you run Code Prover on both source files together, you will see a red non-terminating loop check on the for loop in the first file. If you select this non-terminating loop result on the Results List pane, you will see that it comes from a division by zero error in the second file.
The reason why you do not see the red check in a per-module analysis is that within a module, there is no indication of a definite error. For instance:
  • The definition of reciprocal() is not available when you run Code Prover on module 1 alone. So, within the loop in module 1, the call to reciprocal() might or might not be fine.
  • The call context of reciprocal() is not available when you run Code Prover on module 2 alone. In module 2, reciprocal() might or might not be called with input 0 .
But if you run an analysis on both files together, now there is a definite call to reciprocal() with input 0 (on the 11th run of the loop). Therefore, a red check shows up on the for loop to indicate a definite error in a specific iteration of the loop.
Hope this clarifies a bit. The bottomline is that, you might not see a red check in a per-module analysis if the module is incomplete. Since Code Prover is a sound tool, it will still show a possible error in the per-module analysis, but as an orange check. (For instance, in the preceding example, in all cases, the orange division by zero error appears.) If you see a red check when you do a combined analysis of all sources, you should take this new red check as seriously as you consider regular red checks and investigate and possibly fix the issue.
If you mean something else when you say 'run combined report', then this answer does not apply. For instance, you might run the analysis per module but just combine the results of the per-module analysis in a single report. In that case, you should not see any new red check that was not already there in the individual module results.

Prodotti


Release

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by