# cat empty-loop.c long f() { long i, ret = 0; for (i = 0; i < 1000000000; i++) ret++; return ret; } # gcc empty-loop.c -O2 -S && cat empty-loop.s f: pushl %ebp movl $999999999, %eax movl %esp, %ebp .p2align 4,,15 .L5: decl %eax jns .L5 popl %ebp movl $1000000000, %eax ret source # http://gcc.gnu.org/ml/gcc-help/2004-11/msg00169.html
There might already be a bug about removing empty loops somewhere.
Confirmed, there was some hope for this on 4.1.0, it is too late for 4.0.0.
*** This bug has been marked as a duplicate of 17640 ***