From: Miles Bader <miles@gnu.org>
To: Jonathan Nieder <jrnieder@gmail.com>
Cc: Ramsay Jones <ramsay@ramsay1.demon.co.uk>,
Junio C Hamano <gitster@pobox.com>,
GIT Mailing-list <git@vger.kernel.org>
Subject: Re: [PATCH] Fix an "variable might be used uninitialized" gcc warning
Date: Wed, 01 Feb 2012 16:16:03 +0900 [thread overview]
Message-ID: <buo7h07rpl8.fsf@dhlpc061.dev.necel.com> (raw)
In-Reply-To: <20120131194302.GD12443@burratino>
Jonathan Nieder <jrnieder@gmail.com> writes:
>> The versions which complain are 3.4.4 and 4.1.2, whereas 4.4.0 compiles
>> the code without complaint. So, gcc *may* be getting more sane, but I wouldn't
>> bet on it! :-P
>>
>> I've had examples of this kind of warning, which relies heavily on the
>> analysis performed primarily for the optimizer, come-and-go in gcc before
>
> Yep, judging from the commit message, Junio found the same warning
> in 4.6.2.
>
>> Having said that, unless you are going to decree that the project only
>> supports gcc (and presumably only some particular versions of gcc), then you
>> may well find similar warnings triggered when using other compilers anyway ...
>
> Sure, when the control flow grows too complicated, that's probably worth
> fixing anyway, for the sake of humans especially.
>
> Sometimes gcc is the only crazy one, though. ;-)
It's hard to see how any compiler could detect that "mode" always
receives a value here .... it would have to realize that "stage" always
becomes 2 before the loop is exited, and that seems to depend on
non-trivial properties of external data structures...
-miles
--
Joy, n. An emotion variously excited, but in its highest degree arising from
the contemplation of grief in another.
next prev parent reply other threads:[~2012-02-01 7:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-16 22:44 [PATCH] Fix an "variable might be used uninitialized" gcc warning Ramsay Jones
2011-12-16 23:59 ` Jonathan Nieder
2011-12-17 10:22 ` Andreas Schwab
2012-01-31 18:36 ` Ramsay Jones
2012-01-31 19:43 ` Jonathan Nieder
2012-02-01 7:16 ` Miles Bader [this message]
2012-02-02 18:25 ` Ramsay Jones
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=buo7h07rpl8.fsf@dhlpc061.dev.necel.com \
--to=miles@gnu.org \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=ramsay@ramsay1.demon.co.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).