What is the explanation for "warning: assuming that the loop is not infinite"
Posted
by James Morris
on Stack Overflow
See other posts from Stack Overflow
or by James Morris
Published on 2010-06-05T23:20:33Z
Indexed on
2010/06/05
23:22 UTC
Read the original article
Hit count: 195
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?
© Stack Overflow or respective owner