LLVM/Clang based distro started testing Clang kernel

The big reason to is avoiding single-compiler monoculture. Let's look at an example. A little while ago I was working on a piece of software which did some number crunching and would return a numeric answer. It ran and worked perfectly under Clang, without optimizations. But then I turned on optimizations and got seemingly random answers.

Then I built the same software with GCC, also with optimizations turned off. I still got answers, but different types of wrong numbers. Then I turned on optimizations with GCC and getting right answers.

So two compilers, two sets of optimizations (or none), gave me three different sets of answers for the exact same code. I did some looking and found a variable that had not been initialized properly. Once that was fixed, all four compiler/optimization sets worked and gave right answers.

Had I only tested the defaults on Clang (or optimized code under GCC) the code would have appeared to have been working perfectly and shipped to unsuspecting users. with both compilers resulted in fixed code that would run without concerns as to the compiler settings.

This is why having distros use alternative compilers is important. It reveals a lot of bugs and logic errors that you don't see in a monoculture.

Plus Clang compiles faster in some cases and produces much better warnings/errors. It makes debugging code easier than GCC.

You might also like
Leave A Reply

Your email address will not be published.