From: Ken Raeburn <raeburn@raeburn.org>
To: bug-guile@gnu.org
Subject: Re: [PATCH] fix jump-misses-init warnings
Date: Mon, 14 Sep 2009 04:21:14 -0400 [thread overview]
Message-ID: <92F8E382-0249-4DD2-B5FB-84FBCEEDBDC3@raeburn.org> (raw)
In-Reply-To: <87ws42rn7t.fsf@gnu.org>
On Sep 14, 2009, at 03:37, Ludovic Courtès wrote:
> Why does it help to move locals to the enclosing scope? I’d expect
> the
> opposite.
Jumping over the initializer is a simpler analysis than used-before-
set. It may also yield different results, if the "goto" that branches
into the block and bypasses the initializer can now be reached through
a path that retains a value of the variable in question stored by a
previous pass through that block entering at the top. You could still
warn "possibly used before set", unless that's the only way to get to
that goto statement.
If the logic of the function requires recalculating the value on any
entry to the block, moving the declaration to an outer block is just
masking the bug, not fixing it.
In this case, though, nothing after the label uses the value of the
variable for which the initialization is bypassed, so it seems okay.
Though, I'd think the declaration could be left in the same scope, and
just split into a declaration without initializer and a separate
assignment statement; that would probably suppress the warning without
triggering a used-before-set warning, and wouldn't require renaming
all the other "n" variables. (If it doesn't, I think it might be a
smaller change to rename the variable for which the declaration is
being moved, rather than all the others.)
Ken
next prev parent reply other threads:[~2009-09-14 8:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-09-04 14:36 [PATCH] fix jump-misses-init warnings Giuseppe Scrivano
2009-09-14 7:37 ` Ludovic Courtès
2009-09-14 8:21 ` Ken Raeburn [this message]
2009-09-14 14:44 ` Ludovic Courtès
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
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92F8E382-0249-4DD2-B5FB-84FBCEEDBDC3@raeburn.org \
--to=raeburn@raeburn.org \
--cc=bug-guile@gnu.org \
/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 read-only IMAP folder(s) and NNTP newsgroup(s).