This is the mail archive of the
mailing list for the GCC project.
Re: Empty loop elimination in 4.0 ?
Andrew Pinski wrote:
f[i] = 0;
will be converted to:
memset (f, 0, i * sizeof(*f));
So we end up with an empty loop which then is removed by a later pass.
This is normal thing to do is have later passes remove junk. The
pass which does this transformation has no business in acting as
Yes, of course the warning has to be sensible enough to realize that
this is not an empty loop from the point of view of the programmer.
To me an empty loop is one which generates no code. Clearly the
for loop that the programmer wrote here does generate code. So
what you are pointing out is that this warning has to be clever
enough to distinguish these cases -- sure, I agree!