What is the explanation for "warning: assuming that the loop is not infinite"
- by James Morris
I had just taken the decision to change as many variables from unsigned to int and upon recompiling the code in question, was greeted by this warning message:
freespace_state.c:203: warning: assuming that the loop is not infinite
The line in question:
for (x = startx; x <= endx; ++x, ++xptr)
This loop is 60 lines of code (inc white space/brackets etc), and has a goto within it, and at least one occurrence of continue.
In this case, I think I am appreciative that GCC is assuming this loop is not infinite, because, it should never loop indefinitely.
What is GCC trying to tell me here?