From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ken Raeburn Newsgroups: gmane.lisp.guile.bugs Subject: Re: [PATCH] fix jump-misses-init warnings Date: Mon, 14 Sep 2009 04:21:14 -0400 Message-ID: <92F8E382-0249-4DD2-B5FB-84FBCEEDBDC3@raeburn.org> References: <873a72ydx9.fsf@mandingo.thematica.it> <87ws42rn7t.fsf@gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=WINDOWS-1252; format=flowed; delsp=yes Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1252916507 9850 80.91.229.12 (14 Sep 2009 08:21:47 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 14 Sep 2009 08:21:47 +0000 (UTC) To: bug-guile@gnu.org Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Sep 14 10:21:40 2009 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Mn6od-0005wY-4d for guile-bugs@m.gmane.org; Mon, 14 Sep 2009 10:21:39 +0200 Original-Received: from localhost ([127.0.0.1]:48098 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mn6oc-0004li-BS for guile-bugs@m.gmane.org; Mon, 14 Sep 2009 04:21:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Mn6oV-0004lT-Nd for bug-guile@gnu.org; Mon, 14 Sep 2009 04:21:31 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Mn6oR-0004l8-RT for bug-guile@gnu.org; Mon, 14 Sep 2009 04:21:31 -0400 Original-Received: from [199.232.76.173] (port=46346 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Mn6oR-0004l5-MZ for bug-guile@gnu.org; Mon, 14 Sep 2009 04:21:27 -0400 Original-Received: from splat.raeburn.org ([69.25.196.39]:51724 helo=raeburn.org) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Mn6oJ-0005sj-NW for bug-guile@gnu.org; Mon, 14 Sep 2009 04:21:27 -0400 Original-Received: from [10.0.0.158] ([10.0.0.158]) by raeburn.org (8.14.3/8.14.1) with ESMTP id n8E8LFC6009039; Mon, 14 Sep 2009 04:21:15 -0400 (EDT) In-Reply-To: <87ws42rn7t.fsf@gnu.org> X-Mailer: Apple Mail (2.936) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: bug-guile@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:4315 Archived-At: On Sep 14, 2009, at 03:37, Ludovic Court=E8s wrote: > Why does it help to move locals to the enclosing scope? I=92d expect =20= > the > opposite. Jumping over the initializer is a simpler analysis than used-before-=20 set. It may also yield different results, if the "goto" that branches =20= into the block and bypasses the initializer can now be reached through =20= a path that retains a value of the variable in question stored by a =20 previous pass through that block entering at the top. You could still =20= warn "possibly used before set", unless that's the only way to get to =20= that goto statement. If the logic of the function requires recalculating the value on any =20 entry to the block, moving the declaration to an outer block is just =20 masking the bug, not fixing it. In this case, though, nothing after the label uses the value of the =20 variable for which the initialization is bypassed, so it seems okay. =20= Though, I'd think the declaration could be left in the same scope, and =20= just split into a declaration without initializer and a separate =20 assignment statement; that would probably suppress the warning without =20= triggering a used-before-set warning, and wouldn't require renaming =20 all the other "n" variables. (If it doesn't, I think it might be a =20 smaller change to rename the variable for which the declaration is =20 being moved, rather than all the others.) Ken=