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 m
According to this GCC patch from 2005, it appears that GCC is performing an "unsafe loop optimization" (and you are being warned because -funsafe-loop-optimizations
is set). If the loop is infinite, this particular optimization will fail somehow.
Since you said it is a terminating loop, it sounds as though you have nothing to worry about.
Another relevant part of the patch:
@opindex Wunsafe-loop-optimizations Warn if the loop cannot be optimized because the compiler could not assume anything on the bounds of the loop indices. With @option{-funsafe-loop-optimizations} warn if the compiler made +such assumptions.