lkml.org 
[lkml]   [2002]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectGCC still keeps empty loops? (was: [patch 4/21] fix ARCH_HAS_PREFETCH)
Linus Torvalds wrote:
> I thought that special case was removed long ago, because it is untenable
> in C++ etc (where such empty loops happen due to various abstraction
> issues, and not optimizing them away is just silly).
>
> But testing shows that you're right at least for 2.95 and 2.96. Argh

Unbelievably, 3.1 doesn't remove empty loops either.
I think there's a case for a compiler flag, `-fremove-empty-loops'.

Empty loop delays aren't portable acrosss compilers in general. If you
_really_ want an empty loop that must always work with GCC, it's easy
enough to write:

for (i = 0; i < 100000; i++)
__asm__ __volatile__ ("");
-- Jamie
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:27    [from the cache]
©2003-2011 Jasper Spaans