https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87038

--- Comment #21 from Harald van Dijk <harald at gigawatt dot nl> ---
(In reply to Segher Boessenkool from comment #20)
> That is still not what I said, so don't pretend I did please.
> 
> Those are also not false positives: in all these cases, the program does
> in fact skip some initialisation.

"Pretend"? When you misrepresented my words, I did not accuse you of any type
of deception, I assumed it was simply a misunderstanding and responded
accordingly. I'd appreciate the same treatment from you.

You made an ambiguous comment which I did not recognise as ambiguous at the
time. You wrote:

> -Wall please, unless there are frequent false positives. [...]

"False positive" can be interpreted in two ways. It can be read as a false
positive wrt -Wjump-misses-init, meaning a warning where no initialisation is
jumped over. It turns out this is what you meant. It can also be read as I did,
which is a false positive wrt -Wall, which is documented as:

> This enables all the warnings about constructions that some users
> consider questionable, and that are easy to avoid (or modify to
> prevent the warning), even in conjunction with macros.  [...]

A false positive here would mean that the warning is either about a construct
that users do not consider questionable, or that is not easy to avoid. I was
responding based on the assumption that this is what you meant. Initialisation
is commonly jumped over in large bodies of C code, which is a good indication
that it is not largely considered questionable, and of the cases I'd found,
although all can be worked around to suppress the warning, quite a lot of them
would get a lot uglier.

It did not even scan to me that you might be saying that the only reason you'd
not propose -Wjump-misses-init be included in -Wall is if -Wjump-misses-init
doesn't do what it's supposed to.

> But, it seems -Wjump-misses-init is not what you want; you do not want a
> warning for jumping over initialisers, it warns for a lot of harmless code.
> What you want is a warning that only warns if the var is (potentially) used
> without initialisation?

Yes, at least for -Wall. Since -Wjump-misses-init triggers too often for
commonly used C patterns, I do not think it is appropriate to include it in
-Wall. At the same time, for the originally reported code, it does seem like
*some* warning at -Wall would be appropriate. A warning about the use of the
potentially-uninitialised variable, as clang does, seems sensible to me.

Reply via email to