Linked by Thom Holwerda on Tue 6th Mar 2018 20:08 UTC
Google

As of Chrome 64, Chrome for Windows is compiled with Clang. We now use Clang to build Chrome for all platforms it runs on: macOS, iOS, Linux, Chrome OS, Android, and Windows. Windows is the platform with the second most Chrome users after Android according to statcounter, which made this switch particularly exciting.

Thread beginning with comment 654339
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[2]: slow decline of GCC ?
by kwan_e on Wed 7th Mar 2018 09:49 UTC in reply to "RE: slow decline of GCC ?"
kwan_e
Member since:
2007-02-18

For my relatively simple projects, clang would produce code that's about 10%-15% smaller than gcc.


After -O2 or -Os, I find they're both about the same. Clang is a much faster compiler, hands down. My understanding is that GCC can be overly aggressive in optimization so may end up generating code that isn't the best for relatively simple projects.

Reply Parent Score: 4

jessesmith Member since:
2010-03-11

The optimization thing is definitely true. I have tested code using GCC and Clang with various optimizations turned on. Code compiled with Clang would always run smoothly. Code compiled without optimizations on GCC would also run. But if I turned on optimizations under GCC, the program would crash. Some logic or checks were getting optimized out, but only under GCC, and causing instability.

Warnings and errors are more sane under Clang. The messages are much clearer with references to where things went wrong in Clang. GCC's errors are pretty cryptic in comparison.

I have also noticed GCC throwing incorrect warnings. Like "This variable is declared but unused." But looking through the code shows the variable is, in fact, used and cannot be removed. I still test code under GCC to see if it finds potential problems Clang doesn't, but I do almost all my work with Clang because it is so much more pleasant to use.

Reply Parent Score: 4

RE[4]: slow decline of GCC ?
by viton on Thu 8th Mar 2018 11:06 in reply to "RE[3]: slow decline of GCC ?"
viton Member since:
2005-08-09

But if I turned on optimizations under GCC, the program would crash. Some logic or checks were getting optimized out, but only under GCC, and causing instability.

That means your code is incorrect and suffering from undefined behaviour.
GCC generate more aggressive, faster code than C-lang.
There are a lot of articles on C++ undefined behaviour.

When some parts of your code are optimised-out it means these parts are redundant or not used.

I have also noticed GCC throwing incorrect warnings. Like "This variable is declared but unused."

Check twice. It is pretty safe to assume error is on your side.
Try with different GCC versions. Its is highly unlikely that you found some untested path.

Edited 2018-03-08 11:15 UTC

Reply Parent Score: 4