Gcc Misinterprets Trivial Loop as Infinite
kernel.org
kernel.org
(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.
clang should open the door for intelligent refactoring and analysis tools which aren't possible using the GCC codebase.
The FSF's concern was to have employees maintaining (and controlling the development of) the software and as far as they were concerned that was that.
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.
Clang is still in the beggining, IIRC.
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
--------
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.
So the promise of LLVM is not just being able to compile to every architecture, but to compile every language to every architecture.
I think there's a port to POSIX/ELF environment.
IIRC lcc was a production-quality, if simple, C compiler when it came out in 1995.
Mans covers a lot of incredible retardation here, particularly on ARM and PPC platforms, such as cases where GCC generates 2-3 times the number of instructions necessary for no good reason.
1b. http://x264dev.multimedia.cx/?p=62#comments
Until extremely recently, GCC's handling of multiplications of non-native types has been hilariously bad, up to and including loading the value zero into a register and multiplying by it.
2. General bugginess all over the place, particularly with non-x86 platforms. The number of failed unit tests for ffmpeg with gcc 4.4 on PPC64 was staggering.
Of course, commercial compilers are buggy as well, so this is not really exclusive to GCC; the latest ICC miscompiles large chunks of ffmpeg and Mans has been quite busy submitting bug reports for armcc.
3. Tendency to get worse with every new release; this trend was finally reversed with 4.3 and 4.4, the latter of which was the first compiler to beat 2.9.5 in performance (in ffmpeg, at least):
http://multimedia.cx/eggs/last-performance-smackdown-for-awh...
4. Tendency to declare obvious bugs to be not bugs; for example, failures in the register allocator for inline assembly in which it couldn't allocate 7 registers for the inline assembly despite 7 registers being available (but only inconsistently, on some platforms and some versions, for no apparent reason). Don't have links to the gcc bugtracker on me for these.
5. Incredibly bad optimization on non-x86 architectures. ARM is a particularly horrendous example, where we found the following happening when compiling x264:
a) In the most important DSP function in the program, SATD, GCC unrolled the loop completely. This is related to the fact that there are no loop unrolling heuristics for ARM--and instead of just disabling loop unrolling, the decision is binary ("fully unrolled" vs "not unrolled"), with the former being far too heavily weighted in favor of.
b) GCC then completely failed to allocate registers correctly, resulting in an enormous number of unnecessary loads/stores to the stack.
c) The function's speed was cut in half due to this.
Other issues include GCC's inability to consistently use the ARM's "free shift," up to and including putting shifts on register X right next to another op on register X despite the ability of even a simple peephole optimizer to merge the two instructions.
Also, GCC seems generally bad at three-operand architectures; one will find many redundant moves between registers on ARM, which generally should almost never exist in a three-operand instruction set. Here's an example similar to something I've seen (I don't recall the exact instructions):
add r0, r0, r7
mov r1, r0
mov r0, [r3]
Clearly, this example can be reduced to:
add r1, r0, r7
mov r0, [r3]
When I worked in the chemistry department of my university, we did some compiler benchmarks on Pentium 4's, AMD Athlons and even some Alphas (gcc vs. compaq compiler in this case). We did this at a time where icc was being touted as best than sliced bread, but found out that while it mostly outperformed gcc on the Pentiums, it did so by a small margin. On the Athlons gcc was faster across the board. On the Alphas, gcc was also better (except on fortran code, where compaq compiler was way better).
And this was gcc 3.x. Since then gcc has evolved quite a bit, and I wouln't be surprised to see it take the performance crown everywhere if I repeated these benchmarks today.
To be fair tho', $vendor can concentrate 100% on $processor, GCC at least tries to be cross-platform.
LLVM stands for Low Level Virtual Machine. http://llvm.org/ As I understand it it provides an abstraction layer which could sit below a C compiler for the C code to be compiled down into. If so LLVM will never fully replace GCC or any other C compilers.
I think the OpenBSD project is working on PCC http://pcc.ludd.ltu.se/ as a possible long term replacement for GCC.