Find something wrong in this description?  Help us fix it! 
BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx

Why does PolySpace 5.1.1 (R2008a) show a red non-terminating loop (NTL) check in my code?

BlackCanela Magnanni Shae Magnanni Magnanni Magnanni BlackCanela BlackCanela Shae Magnanni Shae Magnanni Shae BlackCanela Shae BlackCanela Shae X7dwOOPx

Asked by MathWorks Support Team
  • 15,110 questions asked
  • BlackBlack 2ChampagneNavyNude NappaTaupe J Soncino Renee MetallicWhite Kidskin aAqW7FwH
  • Magnanni BlackCanela Shae Shae Shae BlackCanela Magnanni Shae Shae Magnanni Magnanni Magnanni Shae BlackCanela Magnanni BlackCanela BlackCanela 15,112 accepted answers
  • reputation: 6,385
on 27 Jun 2009

My C code looks as follows. When I run a PolySpace verification, the "for" keyword that is mentioned in the comments is marked red with a message that the loop never terminates. Also, I get another red check for a underflow error. I am using the option "-detect-unsigned-overflows".

int main () {
    int intC;
    unsigned int uintA, uintB, i = 0;
    uintA = 20;
    uintB = 30;
    intC = 10;
    // The following keyword "for" is marked with
    // a red NTL check.
    for(i; i < 10; i++) {
      // Subtraction marked with a red UNFL check
      // for a possible underflow.
      if ((uintA - uintB) < uintC) { // UNFL: 20 - 30
        //...
      }
    }
}

Tags

No tags entered yet.

Shae Magnanni BlackCanela Shae Shae BlackCanela Shae Magnanni Magnanni Magnanni BlackCanela Shae Magnanni BlackCanela Magnanni Shae BlackCanela
Short Soft Soft Red Brown Leather OffGrey Harness Soft Phillip Soft Frye Vintage Vintage LeatherBurnt Vintage LeatherCognacDark Brush BlackBlack Vintage LeatherWhiskey Eq60nTp

1 Answer

Answer by MathWorks Support Team BlackCanela BlackCanela Magnanni Magnanni Shae Shae BlackCanela BlackCanela Magnanni Magnanni Shae BlackCanela Shae Magnanni Shae Magnanni Shae on 27 Jun 2009
  Accepted Answer

The red NTL check is caused by the red underflow check (UNFL) within the loop. Correcting the code that causes the UNFL check or removing the option "-detect-unsigned-overflows" will cause the NTL check to disappear.

  0 Comments

Sign in to comment.