GCC 8.1 Released
gcc.gnu.org
gcc.gnu.org
Supported platforms.
Also it does have some extension pragmas and is easier to use for something like trying to use Go baremetal.
gccgo didn't support escape analysis for quite a long time, which meant that the performance cost of the increased heap allocations absolutely dwarfed whatever performance gain you got from GCC's smarter optimizations. I think it's recently gained support for escape analysis—it's actually quite difficult to find information about this, and whether you need a compiler flag to enable it, etc.—but I don't think that's going to tip the performance scales in gccgo's favor. EDIT: See below: 8.1 ships on-by-default escape analysis!
The primary motivations for gccgo, at least to my understanding, were a) having a second reference implementation that could find bugs in gc and the language specification, and b) support for esoteric platforms that will likely never make it into gc. The announcement of gccgo has more information about its motivation, though it makes some claims about performance that haven't stood the test of time [2].
[0]: https://groups.google.com/forum/#!msg/golang-nuts/mjTmIkWKZ6...
[1]: https://dave.cheney.net/2013/11/19/benchmarking-go-1-2rc5-vs...
GCC 8 provides a complete implementation of the Go 1.10.1 user packages.
The garbage collector is now fully concurrent. As before, values stored on the stack are scanned conservatively, but value stored in the heap are scanned precisely.
Escape analysis is fully implemented and enabled by default in the Go frontend. This significantly reduces the number of heap allocations by allocating values on the stack instead.Why would values on the stack be garbage-collected at all? Do they mean scanning the stack for live references?
Scanning the entire heap is different because of its generally much bigger size. It's far more likely then to see references where there are none.
Sadly, those benchmarks (at the bottom of the thread) were done with a GCC that already included all the GCC 8.1 bells and whistles - results were unchanged under 8.1.
So it's still _really_ slow.
I followed the link, and almost all of the changes are C++ related. The exception is a change to the way some Fortran subroutines are called from C.
edit: Oh well, gdc 8.1 is there in the Debian repos. I'll ask Iain Buclaw what happened. Maybe gdc will get released with the next gcc. Looks like the merge wasn't quite complete in time for 8.1. I can be patient.
> The -Wrestrict option introduced in GCC 7 has been enhanced to detect many more instances of overlapping accesses to objects via restrict-qualified arguments to standard memory and string manipulation functions such as memcpy and strcpy.
> The -Wold-style-cast diagnostic can now emit fix-it hints telling you when you can use a static_cast, const_cast, or reinterpret_cast.
Now I'm all for this at -O1 and above, but having this enabled by default and -O0 [0] is just reckless. Default/-O0 should consist of only completely safe transformations like constant folding, with UB-based stuff only performed when optimizations are explicitly enabled.
[0] compare https://godbolt.org/g/ufDu1n on trunk vs the behavior on 7.3 and below
I understand that there are some use cases where teams release binaries compiled with -O0 if they've identified that avoiding unexpected effects of aggressive optimization is more important than raw performance. But in this case, it seems like the right solution is to allow such teams to specifically opt in to allowing overflow via -fwrapv.
Be that as it may in most cases, the compiler shouldn't make an assumption that this is always the case. If I don't pass any optimization options, and especially if I pass -O0, the correct behavior should be "no surprises".
If we do want to redefine -O0 as "dev/debug build for code that will eventually be built with optimizations" rather than just "no funny stuff with my code", there are still a couple problems with that. For one thing, a flag intended for debugging with some optimizations already exists, -Og. Also, if the goal is to expose UB sooner, why not just enable UBsan for these builds?
> I understand that there are some use cases where teams release binaries compiled with -O0 if they've identified that avoiding unexpected effects of aggressive optimization is more important than raw performance. But in this case, it seems like the right solution is to allow such teams to specifically opt in to allowing overflow via -fwrapv.
I think you're underestimating the amount of people who will run "cc foo.c -o foo" and expect it to work, without thinking too much about UB as defined in the C standard, and who haven't ever heard of -fwrapv. By virtue of passing "-O1" in, it's safe for the compiler to assume you know what you're doing, but the default behavior should treat the user as a novice.
The problem with this argument is that before the compiler even enters the picture, the C standard has always specified that signed overflow is UB. I'd argue that providing the additional guarantee that "actually, it'd defined" for the -O0 case only is a bigger surprise than "funny stuff with your code." To categorize treating signed overflow as UB as doing "funny stuff" is off the mark; the behavior was always unspecified.
> I think you're underestimating the amount of people who will run "cc foo.c -o foo" and expect it to work, without thinking too much about UB as defined in the C standard, and who haven't ever heard of -fwrapv. By virtue of passing "-O1" in, it's safe for the compiler to assume you know what you're doing, but the default behavior should treat the user as a novice.
I can't remember the last time I actually invoked a C compiler directly on the command line in the way you're describing (rather than through higher-level build configuration; e.g. generated Makefiles, VS solutions, whatever). I would hope such a use case for non-toy code is... rare.
It still has 4.9 which isn't bad, I'd just like to use new c++ functionality.
Wow, did they finish C++17 support already?
"Are you tired of your existing compilers? Want fresh new language features and better optimizations? Make your day with the new GCC 8.1!"