All of lore.kernel.org
 help / color / mirror / Atom feed
From: Miles Bader <miles@gnu.org>
To: Junio C Hamano <gitster@pobox.com>
Cc: Michael Schubert <mschub@elegosoft.com>,
	Pete Harlan <pgit@pcharlan.com>,
	git@vger.kernel.org
Subject: Re: [bug?] checkout -m doesn't work without a base version
Date: Thu, 15 Dec 2011 13:20:17 +0900	[thread overview]
Message-ID: <buoipli8nzy.fsf@dhlpc061.dev.necel.com> (raw)
In-Reply-To: <7vhb13qbs6.fsf@alter.siamese.dyndns.org>

Junio C Hamano <gitster@pobox.com> writes:
>> builtin/checkout.c: In function ‘cmd_checkout’:
>> builtin/checkout.c:210:5: warning: ‘mode’ may be used uninitialized
>> in this function [-Wuninitialized]
>> builtin/checkout.c:160:11: note: ‘mode’ was declared here
>
> Isn't this just your gcc being overly cautious (aka "silly")?
>
> The variable "mode" is assigned to when we see an stage #2 entry in the
> loop, and we should have updated threeway[1] immediately before doing so.
> If threeway[1] is not updated, we would have already returned before using
> the variable in make_cache_entry().

Maybe that is actually guaranteed (I dunno), but it's certainly not
obvious from the code here, even to a human... any guarantee would
have to come from external invariants that the compiler doesn't know
about.

Given that, I think it's a fair warning, certainly not "silly."  This
aspect of the code doesn't seem easy to understand...

-Miles

-- 
`To alcohol!  The cause of, and solution to,
 all of life's problems' --Homer J. Simpson

  reply	other threads:[~2011-12-15  4:20 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-12-04 22:31 [bug?] checkout -m doesn't work without a base version Pete Harlan
2011-12-05 18:58 ` Junio C Hamano
2011-12-07  7:30   ` Pete Harlan
2011-12-08 18:27     ` Junio C Hamano
2011-12-12  1:48       ` Pete Harlan
2011-12-12  5:29         ` Junio C Hamano
2011-12-20 20:37     ` [PATCH] t/t2023-checkout-m.sh: fix use of test_must_fail Ævar Arnfjörð Bjarmason
2011-12-20 21:23       ` Junio C Hamano
2011-12-14 10:19   ` [bug?] checkout -m doesn't work without a base version Michael Schubert
2011-12-14 17:54     ` Junio C Hamano
2011-12-15  4:20       ` Miles Bader [this message]
2011-12-15 10:11         ` Michael Schubert
2011-12-15 10:42       ` Andreas Schwab
2011-12-15 17:36         ` Junio C Hamano
2011-12-16 22:38           ` 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=buoipli8nzy.fsf@dhlpc061.dev.necel.com \
    --to=miles@gnu.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=mschub@elegosoft.com \
    --cc=pgit@pcharlan.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.