# 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 -- Summary: empty loop / missed-optimization Product: gcc Version: 3.4.3 Status: UNCONFIRMED Severity: minor Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: pluto at pld-linux dot org CC: gcc-bugs at gcc dot gnu dot org GCC build triplet: pentium3-pld-linux GCC host triplet: pentium3-pld-linux GCC target triplet: pentium3-pld-linux http://gcc.gnu.org/bugzilla/show_bug.cgi?id=18648