r/programming • u/mekishizufu • Apr 22 '14
GCC 4.9.0 Released
http://gcc.gnu.org/ml/gcc/2014-04/msg00195.html49
36
u/Maristic Apr 22 '14
See also this thread from nine days ago when /u/grepsedawk jumped the gun and claimed it'd been released.
Also, based on these previous links, it seems like one of the features people are most excited about is GCC's catching up with clang in having colorized diagnostics.
36
u/the-fritz Apr 22 '14
I personally think the LTO improvements, OpenMP 4.0 support, almost all of C11 and C++14, and C++11 <regex> are more exciting. Colourizing the diagnostics is something most editors and IDEs are doing already anyway. (I wonder how many of those will actually run into trouble with this new feature.)
21
u/AnAirMagic Apr 22 '14
Most shell commands can detect whether they are running in a terminal by themselves or as a pipeline and can color output accordingly. I suspect gcc is no different.
9
u/mer_mer Apr 22 '14
I asked this in the previous thread, but OpenMP 4.0 is supposed to have accelerator (gpu) support. Do you know if this is the case in gcc 4.9.0?
→ More replies (1)-9
u/el_muchacho Apr 22 '14 edited Apr 23 '14
I think the gcc team should concentrate on creating an industrial strength static code analyzer rather than the Nth iteration of C++. Security issues like the OpenSSL issue are marring open source as well as commercial projects because of a lack of such a tool.
6
u/WELFARE_NIGGER_ Apr 22 '14 edited Apr 23 '14
They should try and go the Roslyn/Clang way turning the various parts of the compiler modular and allowing them to be used as libraries, e.g. the parser, syntax tree creator, semantic models etc. They should also add support for a framework for writing custom analyzer/refactor modules which can be dynamically loaded by projects, like Roslyn has now but without recompiling the actual compiler.
GCC already has a plugin interface but it isn't tuned for code refacoring and analysis.
1
u/notlostyet Apr 24 '14 edited Apr 24 '14
So 2 significant iterations of C++ in 14 years is too much for you?
And no, OpenSSL sucks because it's written in unmaintainable C and it's massively under resourced. There are bunches of security engineers out there with expensive, world-class static analyzers at their disposal that didn't catch Heartbleed, despite it being a trivial example of an ancient bug class in public code for some 2 years. It took Google to audit the code with human eyeballs.
If anything we need C++ to modernise as quickly as possible, treat its major warts, and get people away from working in the gutter in C.
25
Apr 22 '14
[removed] — view removed comment
3
u/matthieum Apr 23 '14
And I believe gcc also supports ASan and TSan from previous releases, which also help a lot. There was an article from Chromium yesterday stating that TSan had caught a couple hundreds bugs for them already.
→ More replies (2)
45
u/minno Apr 22 '14
And now, I wait for the MinGW team to catch up.
20
u/Camarade_Tux Apr 22 '14
mingw.org or mingw-w64?
In any case, keep in mind that validating a compiler takes some time.
edit: and .0 releases are not always perfect. :)
10
u/minno Apr 22 '14
I'm using the original mingw right now, but I've been considering switching to /u/STL's pre-packaged distribution.
15
u/Camarade_Tux Apr 22 '14
Mingw-w64 is much much closer to upstream. Actually it is part of upstream and usually much more up-to-date. The fact that it takes some time to build and validate still applies though (even more so for Windows).
12
u/Suitecake Apr 22 '14
Hijacking to ask, since you seem like someone who knows:
I (a mere plebe) always feel weird using MinGW and especially MinGW-w64, as it feels dirty and impure. I don't have any real confidence that what I'm using on Windows is anything like what I'm using on Linux. Is that suspicion misplaced? Should I fearlessly use MinGW-w64?
21
u/Camarade_Tux Apr 22 '14
Mingw.org and Mingw-w64 are GCC on Windows with a set of headers to use the Win32 API (and soonish WinRT).
The headers are built either from public documentation or, in the case of mingw-w64, reverse engineering too; the headers in Visual Studio are not free and cannot be used in this context.
The libraries used at runtime are Microsoft's and the ones you might have built in addition to these.
Mingw* projects don't provide additional libraries except when needed for language conformance (C11/C++11 threads, C99 printf functions which fully conform, ...).
So you get GCC and its language support but the libraries are purely from Windows and have nothing to do with (e)glibc/musl/uclibc/... (*) Then, of course, you can have other libraries on top of the system ones provided they're able to handle Windows or use a layer that can handle it.
(*) some code derives from some of the BSD libcs.
6
Apr 22 '14
Should I fearlessly use MinGW-w64?
I sort of use it on smaller stuff but it's not nearly as smooth as using GCC on Linux. It really is impure and dirty and third party libraries never seem to just work unless you're willing to hack through them, which introduces more uncertainty which is why I simply don't dare use it for any production stuff, only for hacking around with C++ functionality on Windows. I can't even recall getting boost to work with MingW, and boost is a pretty freaking core C++ library.
Ugh... if Microsoft just had a standard compliant C compiler and shipped a version of the Win32 API that respected those standards the situation would be much much better.
→ More replies (1)5
u/Rapptz Apr 22 '14
Are you doing something wrong? I've been using MinGW for years and I haven't had an issue. And considering /u/STL has a distribution for MinGW with many libraries, I'm convinced that MinGW isn't the problem here.
→ More replies (1)3
2
u/fabzter Apr 22 '14
Which is that?
10
u/minno Apr 22 '14
This. It comes with mingw-w64 and a ton of libraries and unix command line utilities. I have Cygwin for all my command line needs, but I guess it's nice to not have to install Boost myself.
→ More replies (2)3
u/shillbert Apr 22 '14
I've used that for a long time. Never realized it was made by someone with the initials STL; pretty neat coincidence.
8
u/Sqeaky Apr 22 '14
Who is also the lead developer of microsoft's version of the STL they ship with visual studio.
→ More replies (1)8
3
u/timwoj Apr 22 '14
And now I wait for the Redhat/Scientific Linux devtoolset teams to catch up.
8
u/seruus Apr 22 '14
2016 is close, don't sweat it.
4
u/timwoj Apr 22 '14
Well, they do have one based on gcc 4.8.2 out already, so I can hold a little hope.
-2
8
u/stillalone Apr 22 '14
Does anyone know if LTO works with statically linked libraries?
10
u/morth Apr 22 '14
Don't see why it wouldn't. LTO is basically just compiling halfway when creating the .o and then fully for the final binary.
1
u/skulgnome Apr 23 '14
And it works when some of the objects being linked don't contain the LTO intermediate representation, such as ones generated from assembly or with LLVM.
1
u/ratatask Apr 23 '14
It does. The objects in the static library must be compiled with the -flto flag, and so must the code of the app, and you pass the -flto flag when them.
7
u/jagt Apr 22 '14
Anyone using the Go front end in gcc? It's the first time I heard of it.
15
u/pdq Apr 22 '14
I've used gccgo in the past. It's pretty good, albeit it's lagged the Go mainline for a while, but now that it supports 1.2.1, it should be good to try out again.
gccgo can generate really small binaries (in the kilobyte range for a hello world app), because it links to libc, whereas the standard Go compiler makes static binaries, and a hello world app is multiple MBs.
One thing I am curious of is whether you can use gdb with gccgo. That would be a big win.
0
Apr 22 '14
[deleted]
7
u/pdq Apr 22 '14
To my knowledge, only static.
You can link to additional dynamic libraries, like libpng, but the rest is static.
10
u/AdminsAbuseShadowBan Apr 22 '14
The benefit is of course that it is possible to distribute binaries without going insane.
36
u/parla Apr 22 '14
The insanity comes later, when you need to figure out which go programs you need to recompile to get rid of the next heartbleed bug.
→ More replies (2)0
u/AdminsAbuseShadowBan Apr 22 '14
I've never really thought about it but I think that's actually a terrible argument. Apps come in two ways:
Binary distributions (e.g. all Windows/Mac apps, commercial Linux apps, etc.)
From a package manager.
The binary apps will always come with their own copies of libraries - they can't rely on OpenSSL being included on the host system so they use their own copy. Therefore these will need to be updated even if they are dynamically linked because they will be dynamically linked with a private copy of the vulnerable library.
The distro apps will can easily be updated with the vulnerable library is updated. It might use more data, but that is plentiful these days.
10
u/parla Apr 22 '14
The distro maintainers will need to figure what to rebuild though. And for the record, OpenSSL is distributed with OS X, so no Mac apps would need to link it statically.
→ More replies (1)1
u/tavianator Apr 22 '14
3 . Compiled yourself from source.
Edit: why does reddit change "3." to "1."? :P
→ More replies (2)3
Apr 22 '14
Markdown list syntax. Escape the dot with a backslash if you don't want to start a list (which starts at 1, no matter what number you use).
→ More replies (22)1
8
u/edbluetooth Apr 22 '14
Serious question, if the linux os I am using right now was replaced by the same OS but compiled with this GCC, how much difference in speed (due to the improved optimiser) would I notice?
30
u/asimian Apr 22 '14
The OS kernel itself is almost never a real bottleneck, so I doubt you'd feel any difference at all.
9
u/atakomu Apr 22 '14
The biggest difference when recompiling the kernel comes from compiling only the things you need. In Gentoo my custom compiled kernel had around 2 MB. In Arch stock kernel has 15 MB including initframs image (which wasn't needed in Gentoo).
Boot is maybe a little faster. Problem comes when new gcc or glibc comes and you have to recompile whole system. THis made me switch from Gentoo to Arch I still have the bleeding edge but I don't need to compile stuff every week.
4
u/bit_slayer Apr 22 '14
The biggest difference when recompiling the kernel comes from compiling only the things you need. In Gentoo my custom compiled kernel had around 2 MB. In Arch stock kernel has 15 MB including initframs image (which wasn't needed in Gentoo).
I switched from using Gentoo to Arch for various reasons and was surprised when my boot time actually shrank from minutes to seconds.
5
3
8
Apr 22 '14
Used Arch for a time, switched back to Fedora for a bit more stability. What made me switch was when systemd was rolled out it basically hosed my system (among other issues). Bleeding edge cuts both ways, and I'd rather spend time using my computer than trying to figure out what broke this time. Overall, the updates usually worked ok without too many problems, and are understandable considering the newness of the code, which is more than I can say for Ubuntu releases.
4
u/yentity Apr 22 '14
What made me switch was when systemd was rolled out it basically hosed my system (among other issues)
You switched from a distro moving to systemd to a distro that was already using systemd. Feodra looked safer to you because you went to it after the transition was done.
Fedora is equally bleeding edge as ArchLinux. The only benefits you get out of Fedora is more stuff installed out of the box. Don't for a moment think you are safer on Fedora compared to ArchLinux.
11
u/klusark Apr 22 '14
Only Fedora rawhide is rolling. If you use a numbered Fedora release it's more stable.
4
Apr 22 '14
Apologies if I was misleading and suggested it was 100% fail proof. For me the the major upgrades on Fedora have worked much smoother than either Arch or Ubuntu.
2
u/KARMA_P0LICE Apr 23 '14
No, you're right. I'm a big supporter of Arch, but the systemd update was nontrivial and I can understand why it would frustrate you into switching. At some point, mucking around with configs and spending an hour to upgrade your system can just get tedious.
1
u/rowboat__cop Apr 23 '14 edited Apr 24 '14
In Arch stock kernel has 15 MB including initframs image (which wasn't needed in Gentoo).
Incorrect. You’re talking about the fallback initramfs which comes with every module you can think of in order to ensure maximum compatibility. The stock kernel is actually 3.7 MB (x86_64) plus a 4 MB initramfs. Besides, I like the fact that you can put any binary you like into the initramfs. Regarding the fallback image, the convenience of a custom compiled Vim is worth the extra 10 MB space it takes in
/boot. Being dropped into rootfs is much less intimidating if you’re armed with a full-fledged$EDITOR.7
Apr 22 '14
You can answer this question for yourself if you have a free weekend.
Asimian's answer is almost certainly accurate, though :)
5
u/MacASM Apr 22 '14
How long between gcc releases? I have impression it's each time fastest...
15
11
u/sirin3 Apr 22 '14
Perhaps you are getting older. Changes your time perceptions
9
u/mbetter Apr 23 '14
I had this problem before. Now it's the painting of Richard Stallman in my attic that gets older, not me.
6
2
u/Ono-Sendai Apr 23 '14
It is now possible to call x86 intrinsics from select functions in a file that are tagged with the corresponding target attribute without having to compile the entire file with the -mxxx option. This improves the usability of x86 intrinsics and is particularly useful when doing Function Multiversioning.
finally!
-12
0
Apr 22 '14
[deleted]
9
u/obsa Apr 22 '14
If you're seeing the page rendered in Comic Sans, it's your own local configuration.
143
u/the-fritz Apr 22 '14 edited Apr 22 '14
Some pretty amazing changes: http://gcc.gnu.org/gcc-4.9/changes.html
Shameless promotion: For people interested in GCC related developments: /r/gcc (or @gnutools on Twitter)
That's a huge improvement!