Gentoo Archives: gentoo-dev

From: Richard Yao <ryao@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] Changing policy about -Werror
Date: Fri, 14 Sep 2018 15:55:07
Message-Id: B1C5D954-0267-4E42-9C37-62D7B512BF37@gentoo.org
In Reply to: Re: [gentoo-dev] Changing policy about -Werror by Matt Turner
1 > On Sep 13, 2018, at 11:35 PM, Matt Turner <mattst88@g.o> wrote:
2 >
3 > On Thu, Sep 13, 2018 at 5:44 PM Richard Yao <ryao@g.o> wrote:
4 >>> On Sep 13, 2018, at 7:21 PM, Matt Turner <mattst88@g.o> wrote:
5 >>>
6 >>> On Thu, Sep 13, 2018 at 4:13 PM Richard Yao <ryao@g.o> wrote:
7 >>>>> On Sep 13, 2018, at 12:03 PM, Fabian Groffen <grobian@g.o> wrote:
8 >>>>>
9 >>>>>> On 13-09-2018 07:36:09 -0400, Richard Yao wrote:
10 >>>>>>
11 >>>>>>
12 >>>>>>>> On Sep 12, 2018, at 6:55 PM, Thomas Deutschmann <whissi@g.o> wrote:
13 >>>>>>>>
14 >>>>>>>> On 2018-09-12 16:50, Rich Freeman wrote:
15 >>>>>>>> There is also the case where we want these warnings to block
16 >>>>>>>> installation, because the risk of there being a problem is too great.
17 >>>>>>>
18 >>>>>>> I really disagree with that. So many devs have already said multiple
19 >>>>>>> times in this thread that "-Werror" is only turning existing warnings
20 >>>>>>> into fatal errors but "-Werror" itself doesn't add any new checks and
21 >>>>>>> more often requires "-O3" to be useful.
22 >>>>>> The way that compilers work is that the warnings are generated in the front end while the optimization level affects the backend. That means that -O3 has no effect on the code that does error generation. This remark about -O3 being needed to make -Werror useful is just plain wrong.
23 >>>>>
24 >>>>> Huh? -O3 enables more checks, which can generate more warnings.
25 >>>>
26 >>>> What checks are those? -O3 affects backend optimization while warnings are generated by the front end. Once the immediate representation is generated, there are no other warnings aside from those from the linker.
27 >>>
28 >>> https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html
29 >>>
30 >>> Search for "depend on"
31 >>>
32 >>> -> [...] estimated based on heuristics that depend on thelevel
33 >>> argument and on optimization
34 >>>
35 >>> -> Because these warnings depend on optimization [...]
36 >>>
37 >>> Yes, warnings are dependent on optimization level.
38 >>
39 >> There are three such options. The first two are for format statements:
40 >>
41 >>> “When the exact number of bytes written by a format directive cannot be determined at compile-time it is estimated based on heuristics that depend on the level argument and on optimization. While enabling optimization will in most cases improve the accuracy of the warning, it may also result in false positives. “
42 >>
43 >> My read of this is that the warning occurs regardless of optimization level, but it could somehow be improved by optimization.
44 >>
45 >> As for the last, it is for uninitialized variable reads. However, I think you are misinterpreting the claim. The way that optimization level could affect warning generation would be if the warning generation came after optimization passes that could hide reads. That means that -O3 would prevent the warning.
46 >>
47 >> This is a really odd design decision by the GCC developers. With other compilers, the separation between front end and backend is strong enough that you will never have this sort of thing. It does not seem necessary to me either. :/
48 >
49 > I'm sorry, but you really don't know what you're talking about.
50
51 Either provide code examples that generate warnings in a way that demonstrates that I am incorrect or withdraw that ad hominem.
52
53 > I've
54 > already told you once that you were just adding noise to this
55 > conversation.
56 I can understand the remarks about USE=debug being considered noise given that people seem to think that -Werror is a boolean thing where it is either on for any combination of USE flags or off for any combination of USE flags. However, discussing how compiler internals impacts how -Werror works is definitely not noise.
57
58 You cannot have a discussion about how -Werror should be handled without understanding what I actually does.

Replies

Subject Author
Re: [gentoo-dev] Changing policy about -Werror Sergei Trofimovich <slyfox@g.o>