Live data from Hacker News

GCC 7 Release Series – Changes, New Features, and Fixes

gcc.gnu.org

51–60 of 87 posts

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#51

Earlier quoted context omitted.

No, it's correct. It's saying "if they are always computed, we move them up". IE if (a) foo = a + b else b foo = a + b -> foo = a+b if (a) else (b)

How do you move up towards exit?

My guess is that they meant "up" in the sense of "up in post dominator tree".

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#53
post #2

If you compare (gcc7 and latest clang), how much in pair is gcc with clang in terms of compilation warnings? (One of the most valuable tool of a compiler). I'm really happy they are moving in the same direction; I've been worried about gcc.

There is an important class of warnings which only gcc gets 100% right: Those about optimizing away checks for this != nullptr and &refobject != nullptr (because they will always be true). clang skips the warning inside macros. This is a big problem when you want to find and fix all occurrences before they bite you at runtime.

Many warnings are available in both compilers and effort has been made to use the same names. Both compilers have some warnings exclusively. Clang prefers to raise warnings in the frontend only. Gcc in contrast will sometimes raise more warnings at higher optimization levels. If you can afford the overhead build with clang dbg, gcc O3 and MSVC.

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#54
post #4

On mainstream native platforms, Ada programs no longer require the stack to be made executable in order to run properly. What does that even mean? I'm dabbling with Ada as of recently. Also, woo! Support for the RISC-V instruction set has been added. On topic, I'm using GCC5 and 6 as well as experimenting with 7, and I also have Clang - all available to me via switch/simple shell functions. I always tend to have my j…

The static analysis stuff is something that is in clang's favor. Because of its architecture, static analysis is included, and can be run at compile time through a wrapper called scan-build [1]. So, to get static analysis, most of the time, you just have to run "scan-build make" and it'll do things for you. Clang's clang-tidy tool also handles linting as well, with a misra plugin too [2]. That's the big advantage I see with clang, is that its architecture makes a lot of these things a lot easier to add, which is an area that gcc is just barely starting to address.

[1] https://clang-analyzer.llvm.org/scan-build.html

[2] https://github.com/rettichschnidi/clang-tidy-misra

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#55
post #17

It's only a matter of time before llvm/clang overshadows gcc in every aspect, if it hasn't already. clang probably has 10x more full-time developers than gcc does.

It’s a similar story as with Firefox and Chrome, and you’re sadly right. The free software community is more than ever before at risk of being replaced by a monopoly culture controlled by large corporations.

It's more at risk because they have lost sight of what people want. Firefox muddled itself with a halfassed phone project, a programming language, etc, instead of making a good browser, while google poured efforts into making chrome fast and less prone to crashes taking out everything. It's only natural then that they'd lose market share. Free isn't Good Enough, it has to work well too.

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#56
post #20

Earlier quoted context omitted.

That's what you get when you prefer programs that are merely open source to free software.

Exactly. It's like when evaluating things people just completely forget about the implications of the license they use, in both specific and broad contexts. I use and support GPL products as much as possible, even when a BSDesque product may actually have a few advantages. I'm not 100% on that either, but I try hard to slowly adapt and use truly foss software and get used to the ecosystem mentality changes they requi…

I'd argue the opposite, that GPL style licenses make it easier to hide things in black boxes these days. LLVM and Clang are under BSD style licenses, and even Sony has said that being an active contributor keeps things moving along [1] even when they don't have to contribute back. Plus, most BSD-style code doesn't require things like copyright assignment, which can be a big brake against people from contributing back.

Additionally, a lot of GPL software, like MySQL and BerkeleyDB, create a more closed community because that company has a lot more ability to create their own black box projects through dual licensing as closed source works. Postgres, in comparison, is BSD licensed, making it much harder for a company like Oracle to buy out pieces of the community and run away with the source and make deals others can't. The GPL has a lot less community power to counter those sorts of situations.

[1] http://llvm.org/devmtg/2013-11/slides/Robinson-PS4Toolchain....

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#58

Sigh, looks like one of my common idioms: if (int_value) { ... } Will now be warned/failed.

Hmm, I wonder if that's actually true. I don't have GCC 7 anywhere to actually test it, but the documentation[1] states:

  -Wint-in-bool-context
Warn for suspicious use of integer values where boolean values are expected, such as conditional expressions (?:) using non-boolean integer constants in boolean context, like

  if (a 
Or left shifting of signed integers in boolean context, like

  for (a = 0; 1 
Likewise for all kinds of multiplications regardless of the data type. This warning is enabled by `-Wall`.

[1]: https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#59
post #58

Sigh, looks like one of my common idioms: if (int_value) { ... } Will now be warned/failed.

Hmm, I wonder if that's actually true. I don't have GCC 7 anywhere to actually test it, but the documentation[1] states: -Wint-in-bool-context Warn for suspicious use of integer values where boolean values are expected, such as conditional expressions (?:) using non-boolean integer constants in boolean context, like if (a Or left shifting of signed integers in boolean context, like for (a = 0; 1 Likewise for all kind…

I'm guessing (again I can't really test it yet) that it will warn on it and suggest

   if (int_value != 0) { ... }
To be clear about what I mean.

Re: GCC 7 Release Series – Changes, New Features, and Fixes

#60
post #53
post #2

If you compare (gcc7 and latest clang), how much in pair is gcc with clang in terms of compilation warnings? (One of the most valuable tool of a compiler). I'm really happy they are moving in the same direction; I've been worried about gcc.

There is an important class of warnings which only gcc gets 100% right: Those about optimizing away checks for this != nullptr and &refobject != nullptr (because they will always be true). clang skips the warning inside macros. This is a big problem when you want to find and fix all occurrences before they bite you at runtime. Many warnings are available in both compilers and effort has been made to use the same name…

I disagree about warnings inside macros. There are lots of functions like strtod which take an argument and say "if this is non-NULL, store a value into the pointed-to variable", so that you can write "foo(..., &x)" if you want the value and "foo(..., NULL)" if you don't. This is a recipe for a warning which gets disabled due to an excess of false positives.

(I'd say that this warning could be explicitly disabled for the scope is the macro... but alas, GCC broke _Pragma inside macros.)

Post reply on HN