From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#44724: Uninitialised variables in syntax.c cause trouble. Date: Wed, 18 Nov 2020 20:26:10 +0000 Message-ID: <20201118202610.GB10071@ACM> References: <20201118171726.GA10071@ACM> <1b64b1bf-b12e-7a13-2a33-4a308cf38873@gmx.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="34441"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 44724@debbugs.gnu.org To: martin rudalics Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Nov 18 21:27:12 2020 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kfU2q-0008qI-HK for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Nov 2020 21:27:12 +0100 Original-Received: from localhost ([::1]:35722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kfU2p-0007ZO-KE for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 18 Nov 2020 15:27:11 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:56354) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kfU2g-0007ZB-Q5 for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2020 15:27:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:53273) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1kfU2g-0002OI-7M for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2020 15:27:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1kfU2g-00027C-2c for bug-gnu-emacs@gnu.org; Wed, 18 Nov 2020 15:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 18 Nov 2020 20:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 44724 X-GNU-PR-Package: emacs Original-Received: via spool by 44724-submit@debbugs.gnu.org id=B44724.16057311818079 (code B ref 44724); Wed, 18 Nov 2020 20:27:02 +0000 Original-Received: (at 44724) by debbugs.gnu.org; 18 Nov 2020 20:26:21 +0000 Original-Received: from localhost ([127.0.0.1]:36586 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1kfU21-00026F-4v for submit@debbugs.gnu.org; Wed, 18 Nov 2020 15:26:21 -0500 Original-Received: from colin.muc.de ([193.149.48.1]:17331 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1kfU1y-000260-3k for 44724@debbugs.gnu.org; Wed, 18 Nov 2020 15:26:20 -0500 Original-Received: (qmail 39456 invoked by uid 3782); 18 Nov 2020 20:26:11 -0000 Original-Received: from acm.muc.de (p4fe15a12.dip0.t-ipconnect.de [79.225.90.18]) by localhost.muc.de (tmda-ofmipd) with ESMTP; Wed, 18 Nov 2020 21:26:10 +0100 Original-Received: (qmail 12530 invoked by uid 1000); 18 Nov 2020 20:26:10 -0000 Content-Disposition: inline In-Reply-To: <1b64b1bf-b12e-7a13-2a33-4a308cf38873@gmx.at> X-Delivery-Agent: TMDA/1.1.12 (Macallan) X-Primary-Address: acm@muc.de X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:193645 Archived-At: Hello, Martin. On Wed, Nov 18, 2020 at 18:57:37 +0100, martin rudalics wrote: > > In src/syntax.c, there are several uninitialised static variables, one of > > which is find_start_value. > > It is used in function find_defun_start before being initialised. The > > first use is at L.14 of the function, this: > > && pos >= find_start_value > > . This has the effect of causing a certain (forward-comment -1) (which > > calls back_comment, which calls find_defun_start) to fail. > > In my test setup (I am writing tests for syntax.c), find_start_value's > > value at loading time was randomly 1270, which was spuriously inside the > > comment I was trying to scan backwards over. back_comment thus failed to > > recognise the comment, and returned failed. > Just curious: Did current_buffer == find_start_buffer really succeed > in your scenario? Yes it did. All four comparisons in that block of code succeeded, causing a spurious value to be returned by find_defun_start. But now I think that that value was a previously valid one which just hadn't been updated on buffer changes. I don't think there's any cache invalidation code associated with this cache, and I think that's why it gave an invalid result. > martin -- Alan Mackenzie (Nuremberg, Germany).