This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -funsafe-loop-optimizations
Daniel Jacobowitz wrote:
It's a funny sort of "bug" unless we have useful ways to "fix" it :-)
I suppose you could write "< n + 1" instead, which is the same except for
transforming Inf iterations to 0...
You can't expect a compiler to fix bugs in your program :-)
After all, from a strict semantic point of view, there is no bug, it
is just that this function goes into an infinite loop when n is max
value. That's what you asked for (and that's what you get from a
conforming compiler). The most a compiler can do is to warn you
that the coding looks suspicious, and that's what we are discussing
here. But the issue of this warning seems independent to me of
the issue of whether to "miscompile" the marginal case.