News for hackers. Stuff that matters.
Re:Clang (LLVM C compiler) builds a working Linux kernel by fleitz on Tuesday October 26, 2010 @12:14AM (#1832942)
It may make certain bugs more apparent.

If you have development going on with a different compiler and it's actively maintained to work on both compilers then overall you'd get similar advantages in your code base to those that write cross-platform software. Incidentally, you get the same effect with cross-platform as you're usually targeting different compilers.

Also, with less compiler specific code it will be easier to get the kernel working with other compilers, perhaps ICC.

Re:Clang (LLVM C compiler) builds a working Linux kernel by mzl on Tuesday October 26, 2010 @12:28AM (#1832971)
Unfortunately, Clang is still a bit shaky at times. In our (C++) project, we get a miscompilation in Clang that we don't get with gcc, the visual studio compiler, nor the intel compiler. It will be great when it is more stable: clang cuts the compile time by half in comparison with gcc (from 18 minutes to 9 minutes on my computer).
Re:Clang (LLVM C compiler) builds a working Linux kernel by wash on Tuesday October 26, 2010 @02:04AM (#1833234)
I do a lot of C++ template metaprogramming, so I end up running into 3-5 Clang internal compiler errors (In my circles, "ICE"s) a week, if not more. With GCC I maybe run into 3-5 a month.

The difference is that I can pinpoint the error. Clang dies gracefully, with a stack trace, source file location, and, for parse errors, the tokens that are currently being parsed. The problem might not always be easy to fix, but I never have to waste time trying to find it.

If you want a more stable Clang, then build one. ;)

Re:Clang (LLVM C compiler) builds a working Linux kernel by X-Istence on Tuesday October 26, 2010 @12:30AM (#1832977)
File a bug report. They are very receptive of them. Especially if you get a miscompilation.
Re:Clang (LLVM C compiler) builds a working Linux kernel by mzl on Tuesday October 26, 2010 @12:51AM (#1833047)
I hope to do so, I really like the project and want it to succeed. Unfortunately, I'm not yet sure how to reduce the 100000 lines to something manageable with the problem clear :)
Re:Clang (LLVM C compiler) builds a working Linux kernel by sparky on Tuesday October 26, 2010 @01:09AM (#1833099)
Do you suspect the bug to be in clang (the front-end) itself, or in LLVM's optimizer or back-end? For the latter cases, bugpoint is included in the LLVM source tree and does a good job of narrowing things down, so long as you provide a program whose output should be deterministic (this may involve some work on your part if your program usually depends on data from the outside world). It is described here http://llvm.org/docs/Bugpoint.html . It may be useful for Clang bugs too, I'm not sure.

People may help you by suggesting strategies for finding a small test case that tickles the same problem if you post to the mailing list here http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev . I've posted a couple times and found people surprisingly responsive and helpful.

Re:Clang (LLVM C compiler) builds a working Linux kernel by mzl on Tuesday October 26, 2010 @01:31AM (#1833152)
That looks like an interesting tool, I'll have to try it out. The program is deterministic given a fixed seed.

The bug depends on whether or not optimization is on, so it might be in the backend. What I've heard is that the C++ FE in particular still does have some troubles with miscompilations, so that is why I suspect it.

Re:Clang (LLVM C compiler) builds a working Linux kernel by chc on Tuesday October 26, 2010 @01:27AM (#1833138)
Clang is really good at C and Objective-C. C++ is kind of its weak point, most likely because C++ is a couple of orders of magnitude more complex than either of those languages.
Re:Clang (LLVM C compiler) builds a working Linux kernel by mzl on Tuesday October 26, 2010 @02:16AM (#1833262)
I was actually surprised that it could compile our stuff at all, and that it runs mostly all right. We do use a lot of the language, and we need at least gcc version 4.2 for example.