From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.bugs Subject: bug#28850: 26.0.90; Error running timer 'jit-lock-stealth-fontify': (error "Invalid search bound (wrong side of point)") Date: Sat, 4 May 2019 12:41:02 +0000 Message-ID: <20190504124102.GB4139@ACM> References: <20171022201340.GA16074@ACM> <834lqoa9jj.fsf@gnu.org> <20171024203312.GA5875@ACM> <20171025191137.GA16060@ACM> <83wp3h7tar.fsf@gnu.org> <87o94oz210.fsf@tcd.ie> <20190430113302.GB4142@ACM> <8736lzirbn.fsf@tcd.ie> <83h8afsee5.fsf@gnu.org> <83y33qovrw.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="129649"; mail-complaints-to="usenet@blaine.gmane.org" User-Agent: Mutt/1.10.1 (2018-07-13) Cc: contovob@tcd.ie, 28850@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat May 04 14:43:17 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1hMu0b-000Xd0-HB for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 May 2019 14:43:17 +0200 Original-Received: from localhost ([127.0.0.1]:56162 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMu0a-00016Q-JL for geb-bug-gnu-emacs@m.gmane.org; Sat, 04 May 2019 08:43:16 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:58878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1hMtzQ-0000ML-T8 for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 08:42:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hMtzP-0005zD-3A for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 08:42:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:36989) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1hMtzN-0005yR-SR for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 08:42:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1hMtzN-0002Av-PA for bug-gnu-emacs@gnu.org; Sat, 04 May 2019 08:42:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Alan Mackenzie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 04 May 2019 12:42:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 28850 X-GNU-PR-Package: emacs Original-Received: via spool by 28850-submit@debbugs.gnu.org id=B28850.15569736718289 (code B ref 28850); Sat, 04 May 2019 12:42:01 +0000 Original-Received: (at 28850) by debbugs.gnu.org; 4 May 2019 12:41:11 +0000 Original-Received: from localhost ([127.0.0.1]:50533 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1hMtyY-00029d-Ss for submit@debbugs.gnu.org; Sat, 04 May 2019 08:41:11 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:34897 helo=mail.muc.de) by debbugs.gnu.org with smtp (Exim 4.84_2) (envelope-from ) id 1hMtyV-00029O-MX for 28850@debbugs.gnu.org; Sat, 04 May 2019 08:41:08 -0400 Original-Received: (qmail 45693 invoked by uid 3782); 4 May 2019 12:41:04 -0000 Original-Received: from acm.muc.de (p4FE150FB.dip0.t-ipconnect.de [79.225.80.251]) by colin.muc.de (tmda-ofmipd) with ESMTP; Sat, 04 May 2019 14:41:02 +0200 Original-Received: (qmail 5494 invoked by uid 1000); 4 May 2019 12:41:02 -0000 Content-Disposition: inline In-Reply-To: <83y33qovrw.fsf@gnu.org> 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-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.51.188.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:158739 Archived-At: Hello, Eli. Sorry it's taken me a little time to answer you. I was rather busy with another bug. On Wed, May 01, 2019 at 21:49:07 +0300, Eli Zaretskii wrote: > > Date: Tue, 30 Apr 2019 18:26:26 +0300 > > From: Eli Zaretskii > > Cc: acm@muc.de, 28850@debbugs.gnu.org > > > > FWIW, I think I see something similar in Emacs 26.2, I will try to > > catch it one of these days. > Done. The error messages are slightly different: wrong-type-argument > number-or-marker-p nil. > It was very hard to debug, but eventually I succeeded to catch a > backtrace: > Thread 1 hit Breakpoint 5, wrong_type_argument (predicate=XIL(0x9f90), > value=XIL(0)) at data.c:146 > 146 { > #0 wrong_type_argument (predicate=XIL(0x9f90), value=XIL(0)) at data.c:146 > #1 0x01127519 in CHECK_TYPE (x=XIL(0), predicate=, ok=0) > at lisp.h:625 [ .... ] > Lisp Backtrace: > "1+" (0x88acd0) > "goto-char" (0x88adb8) > "save-excursion" (0x88aee8) > "cond" (0x88aff8) > "setq" (0x88b138) > "let" (0x88b2b8) > "if" (0x88b3d8) > "catch" (0x88b548) > "while" (0x88b668) > "if" (0x88b788) > "save-restriction" (0x88b8b8) > "let" (0x88baf8) > "c-beginning-of-statement-1" (0x88bbf0) > "setq" (0x88be48) > "eq" (0x88bf38) > "not" (0x88c028) > "and" (0x88c138) > "while" (0x88c258) > "let" (0x88c3d8) > "let*" (0x88c528) > "catch" (0x88c698) > "c-beginning-of-decl-1" (0x88c810) > 0xadfab48 PVEC_COMPILED > "font-lock-fontify-keywords-region" (0x88d0c0) > "font-lock-default-fontify-region" (0x88d410) > "c-font-lock-fontify-region" (0x88d740) > "font-lock-fontify-region" (0x88d9e8) > 0x18b47060 PVEC_COMPILED > "run-hook-wrapped" (0x88de00) > "jit-lock--run-functions" (0x88e150) > "jit-lock-fontify-now" (0x88e5b0) > "jit-lock-stealth-fontify" (0x88ea60) > "apply" (0x88ea58) > "timer-event-handler" (0x88eda8) > This comes from the following code fragment: > (defun c-beginning-of-statement-1 (&optional lim ignore-labels > noerror comma-delim) > [...] > ;; Just gone back over some paren block? > ((looking-at "\\s(") > (save-excursion > (goto-char (1+ (c-down-list-backward > before-sws-pos))) > (c-crosses-statement-barrier-p > (point) maybe-after-boundary-pos))) > c-down-list-backward is documented to be able to return nil, so > passing the result to 1+ is unsafe. The movement function which brought point to that "\\s(" was c-backward-sexp, i.e. (goto-char (scan-sexps (point) -1)), so the nil that you got from c-down-list-backward "can't possibly happen". :-( > I cannot claim a good understanding of the code, .... Long ago, that function, before it was rewritten by Martin Stjernholm, carried the comment "if you think you understand this function you are probably mistaken." ;-). > .... but the following ad-hoc patch fixes the problem for me: > --- lisp/progmodes/cc-engine.el~0 2019-01-07 16:26:06.000000000 +0200 > +++ lisp/progmodes/cc-engine.el 2019-05-01 14:43:35.823456200 +0300 > @@ -1130,10 +1130,12 @@ > ;; Just gone back over some paren block? > ((looking-at "\\s(") > (save-excursion > - (goto-char (1+ (c-down-list-backward > - before-sws-pos))) > - (c-crosses-statement-barrier-p > - (point) maybe-after-boundary-pos))) > + (let ((pos1 (c-down-list-backward > + before-sws-pos))) > + (when (number-or-marker-p pos1) > + (goto-char (1+ pos1)) > + (c-crosses-statement-barrier-p > + (point) maybe-after-boundary-pos))))) > ;; Just gone back over an ordinary symbol of some sort? > (t (c-crosses-statement-barrier-p > (point) maybe-after-boundary-pos)))) However, that nil clearly did happen, so I'll be spending some time working out how it could have happened, and amending c-beginning-of-statement-1 accordingly, whether with your ad-hoc patch or otherwise. Thanks for taking so much time and trouble to get that stack trace. -- Alan Mackenzie (Nuremberg, Germany).