5 ms·
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 s
by gchpaco 17y ago
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 17y agoActually, clang has nothing to do with gcc. LLVM's gcc frontend is called llvm-gcc ( http://llvm.org/cmds/llvmgcc.html 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 17y agoAs 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 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 17y agoYet, all the world is not x86.
- chancho 17y agoSee 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.
- joeyo 17y agoBut isn't this the whole point of LLVM? Separating the compile process into two intermediate steps, one of compiling a programming given language into an intermediate virtual machine and another of compiling that virtual machine code into a binary for the target architecture. Then each module of the LLVM can be worked on and optimized independently with little duplication of labor. So the promise of LLVM is not just being able to compile to every architecture, but to compile every language to every architecture.
- dexen 17y agoThere's kencc compiler/linker suite, written by Ken Thompson. It's almost ANSI compatible, with preprocessor limited on a purpose and an extension for easier nested structure member access. I think there's a port to POSIX/ELF environment.
- kragen 17y agotcc isn't a toy, but it's optimized for a very different scenario than GCC, one where compilation speed and small compiler size are paramount, winning out over things like error reporting and output code quality. IIRC lcc was a production-quality, if simple, C compiler when it came out in 1995.