MATLAB: Do I receive a red NTL error on a for-loop in PolySpace

Polyspace Code ProverPolyspace Code Prover Server

I receive a red non terminating loop (NTL) error on a for-loop in my analysis, although everything inside the loop is colored green, so I guess there is no runtime error inside of my loop.

Best Answer

This issue might be caused by an orange error which is hiding a red error. For instance there could be an out of bounds access (OBAI) error in a function called in one of the iterations in your for-loop. If so PolySpace propagating the red NTL error not to the function itself, but to the loop where this function is involved.
To detect this kind of errors you can use PolySpace to report the range of your for-loop's iteration variable. If PolySpace reports a smaller range than you set in your for-loop then probably one of the later iterations fails and causes the for-loop to not terminate.