

Gcc Misinterprets Trivial Loop as Infinite - frisco
http://www.kernel.org/pub/linux/kernel/v2.6/ChangeLog-2.6.30.3

======
GeneralMaximus
This is not the first time I've heard people complaining about GCC. Could
someone who knows compilers intimately explain why so many people dislike GCC?
Are there any FOSS alternatives? Also, can LLVM be a drop-in replacement for
GCC sometime in the future?

(The complaints I've hear so far range from GCC having a crappy register
allocator to it generating code that is downright wrong.)

EDIT: Spelling.

~~~
gchpaco
There are effectively no FOSS alternatives. A few groups have toyed with
making their own C compiler; some in the BSDs were toying with I think lcc,
and I've seen reference to tcc. The thing of it is GCC is very mature and
quite good at what it does, and neither lcc nor tcc are much more than toys.
They won't make this mistake, but that's because they do next to no
optimization anyway. GCC makes the occasional error--all compilers do, and I
don't expect this bug to survive the next point release.

This hasn't always been the case--GCC _did_ have a crappy register allocator
once upon a time, and it didn't do a variety of SSA-based optimizations once
upon a time, and a lot of these complaints ultimately date back to those days.
Pre-egcs there was a lot more talk about replacing GCC, but now that it has
actually been actively maintained and developed that seems to have largely
dissipated.

LLVM is no real answer. It currently uses a GCC frontend. Clang, which I think
is what you were referring to, is not intended to replace GCC's optimization
layer, which is what's causing this problem.

~~~
alextp
Actually, clang has nothing to do with gcc. LLVM's gcc frontend is called
llvm-gcc ( <http://llvm.org/cmds/llvmgcc.html> ) which was dropped for being
too high maintenance or something of the sort.

Clang is still in the beggining, IIRC.

~~~
pg42
As far as I know llvm-gcc has not been dropped. On Mac OS X it is even
installed alongside gcc when you install the developer tools.

Clang is making good progress. From <http://clang.llvm.org/index.html>: Clang
is considered to be a production quality C and Objective-C compiler when
targetting X86-32 and X86-64

~~~
CrLf
Yet, all the world is not x86.

~~~
chancho
See DarkShikari's comment for details on what goes wrong when a compiler tries
to be all things to all architectures.

\--------

I should clarify. I agree with what you said below, these days GCC is an
excellent compiler for x86. It's just that it's near to impossible to be so
excellent for all archs.

------
live_to_code
Given issues like this, and how talented the kernel guys are ... why haven't
they written a C compiler? (Not meant to rant; serious question -- we wrote
silly C compilers for class; seems like programmers with real talent should be
able to write real, industry strength C compilers, especially if it only needs
to support C, and not C++/Java/ObjC/...)

~~~
tlrobinson
It's an intriguing idea to have a compiler designed for kernel code, and it
has been proposed before: [http://linux.derkeiler.com/Mailing-
Lists/Kernel/2009-04/msg1...](http://linux.derkeiler.com/Mailing-
Lists/Kernel/2009-04/msg10510.html)

------
known
And GCC 4.0 is incompatible with STL.

~~~
queensnake
C++'s Standard Template Library? I bet you're talking about how it complains
about your out-of-spec code. Lots of not recognizing c-string functions like
strlen, strcmp etc? 4.x doesn't include <string.h> along with <string>
anymore, you have to add it explicitly.

