The venerable GCC compiler got itself into the news by winning an award from the ACM and by attracting a typical Linus Torvalds blast of rhetoric for an "interesting" bug.
GCC has been around a while and it is surprising that it hasn't won the ACM's Programming Languages Software award earlier in its 30-year history. After all the LLVM project got an award from the ACM two years ago and it's a youngster at about 10 years old.
The Award citation says it all:
"The GNU Compiler Collection (GCC) provides a portable, production-quality, standards-compliant, highly optimizing compiler, supporting more architectures, programming languages, and operating environments than any other comparable tool. It provides the toolchain that underpins all of the GNU/Linux distributions, popular websites, and embedded environments.
GCC provides the foundation for numerous experiments in programming language design, including the early C++ language, numerous evolutions of the C and C++ standards, parallel programming with OpenMP, and the Go programming language. GCC has been used by many research projects, leading to high-impact publications and contributions to the development trunk, including sophisticated instruction selection based on declarative machine descriptions, auto-tuning techniques, transactional memory, and polyhedral loop nest optimizations."
Along with the fame comes a little fortune in the form of $2,500 which is being donated to the FSF - not enough really is it?
At the same time as being lauded for its experimental and sophisticated approach to optimization, Linus Torvalds tore a strip off the very same software for a bug that affects the Linux kernel. If you know anything about Linus at all you will be expecting the rude or forthright outpouring that he generated.
"Ok, so I'm looking at the code generation and your compiler is pure and utter sh*t.
Lookie here, your compiler does some absolutely insane things with the spilling, including spilling a *constant*. For chrissake, that compiler shouldn't have been allowed to graduate from kindergarten.
We're talking "sloth that was dropped on the head as a baby" level retardation levels here:"
The post to the Linux Kernel Mailing List goes on to explain the bug in detail and how it interacts with another bug. In case you aren't upon the details of compiler optimization, and not many of us are, the criticism of "spilling a constant" is all about register allocation. Ideally you would like to keep data that is used a lot in a register but sometimes you run out of registers and have to "spill" the contents of a register back into memory. This is all fine but constants never change their value so you don't have to load a register with a constant or spill a constant back to memory. A constant can be implemented as immediate mode data and so never needs to be in a register, let alone removed to free a register. The fact that a constant is being spilled in an x86 or similar architecture is indeed a failure of code generation.
The real bug, however, is the way that the scratch area of the stack is used unintentionally to store data which could be overwritten by an interrupt. Linux doesn't use the scratch storage on the stack convention and so it really could cause the Kernel to crash.
The two main points, however, are that the bug isn't in the Linux Kernel but in the compiler; and that the Kernel team should switch back to an earlier version.
In fact the bug was probably known about and is most likely already fixed and the problem is that Debian isn't up to date with the GCC distribution. The uncertainty is whether this was the exact bug that is being reported by Linus.
Of course, most of the discussion of the bug report has been about Linus and the language he uses. Personally I find the way that he phrases it amusing, but would I if I was a GCC programmer? I hope so because I really don't think it is intended as a personal insult - just a way of pointing out how dumb the bug is. It is the code that is the target of the insults.
It is also important to remind the GCC programmers that what they are working on is the foundation stone of a lot of things that we build and, while optimization is desirable, correct code generation is essential. Experimentation is how you win ACM awards. Creating solid code is how you avoid waking up Linus.
And the animal on the GCC logo is a GNU not a Sloth.
If you have ever taken on the task of digitizing old photos you will know that it is a tough job. Now Google has applied computational photography to make it easy with just a phone camera - you take a [ ... ]