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#59038: loading this base64 file makes emacs -Q 28.2 peg a core infinitely Date: Sun, 6 Nov 2022 16:34:57 +0000 Message-ID: References: <83h6zd51h0.fsf@gnu.org> <62a776a86318abee7349@heytings.org> <62a776a8636ebc0aad56@heytings.org> <83a7ad518e21593e8888@heytings.org> <83iljs197i.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25791"; mail-complaints-to="usenet@ciao.gmane.io" Cc: psainty@orcon.net.nz, gerd.moellmann@gmail.com, Gregory Heytings , 59038@debbugs.gnu.org, checker@d6.com To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Nov 06 17:36:21 2022 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 1oridB-0006ca-2N for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 06 Nov 2022 17:36:21 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oricv-0000ZO-1m; Sun, 06 Nov 2022 11:36:05 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1orics-0000Yz-Vd for bug-gnu-emacs@gnu.org; Sun, 06 Nov 2022 11:36:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1orics-0000gs-NJ for bug-gnu-emacs@gnu.org; Sun, 06 Nov 2022 11:36:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1orics-00017d-Ir for bug-gnu-emacs@gnu.org; Sun, 06 Nov 2022 11:36: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: Sun, 06 Nov 2022 16:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 59038 X-GNU-PR-Package: emacs Original-Received: via spool by 59038-submit@debbugs.gnu.org id=B59038.16677525104251 (code B ref 59038); Sun, 06 Nov 2022 16:36:02 +0000 Original-Received: (at 59038) by debbugs.gnu.org; 6 Nov 2022 16:35:10 +0000 Original-Received: from localhost ([127.0.0.1]:60494 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oric1-00016T-PL for submit@debbugs.gnu.org; Sun, 06 Nov 2022 11:35:10 -0500 Original-Received: from mx3.muc.de ([193.149.48.5]:22034) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oriby-00015s-3d for 59038@debbugs.gnu.org; Sun, 06 Nov 2022 11:35:08 -0500 Original-Received: (qmail 58269 invoked by uid 3782); 6 Nov 2022 17:34:58 +0100 Original-Received: from acm.muc.de (p2e5d5417.dip0.t-ipconnect.de [46.93.84.23]) (using STARTTLS) by colin.muc.de (tmda-ofmipd) with ESMTP; Sun, 06 Nov 2022 17:34:58 +0100 Original-Received: (qmail 26392 invoked by uid 1000); 6 Nov 2022 16:34:57 -0000 Content-Disposition: inline In-Reply-To: <83iljs197i.fsf@gnu.org> X-Submission-Agent: TMDA/1.3.x (Ph3nix) 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: , Original-Sender: "bug-gnu-emacs" Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:247223 Archived-At: Hello, Eli. On Sun, Nov 06, 2022 at 15:52:33 +0200, Eli Zaretskii wrote: > > Date: Sun, 06 Nov 2022 09:18:23 +0000 > > From: Gregory Heytings > > cc: Eli Zaretskii , > > Gerd Möllmann , > > 59038@debbugs.gnu.org, checker@d6.com, acm@muc.de > > >> That file opens just fine in other modes > > > It also opens fine in c-mode, with global-font-lock-mode disabled. > > Indeed, obviously it's a c-mode font-locking related bug. > > >> Note that this bug has nothing to do with long lines. > > > I imagine that the font-lock issue is related to the line being in > > > excess of 21,000 chars (but general redisplay obviously doesn't have > > > problems with lines this 'small'). > > > Reduced to 10,208 chars that file opens instantly under emacs -Q in > > > c-mode with font-lock enabled; but at 10,209 chars it hangs Emacs (I > > > killed it after waiting 4 minutes). > > Interesting, thanks for the bisection! > It's an infloop in c-brace-stack-at. > What happens is that c-brace-stack-at calls c-update-brace-stack with > arguments: (nil 1) 8160 13160. c-update-brace-stack then calls > c-syntactic-re-search-forward, which finds nothing interesting and > returns with point at 13160, but then c-update-brace-stack calls > c-beginning-of-current-token, which returns point back to 8160. And > it goes on and on and on... Thanks for the debugging. > Alan, what can be done with this? This: diff -r 53717eda724c cc-engine.el --- a/cc-engine.el Sat Oct 29 09:42:47 2022 +0000 +++ b/cc-engine.el Sun Nov 06 16:26:09 2022 +0000 @@ -6177,9 +6177,10 @@ (setq s (cdr s)))) ((c-keyword-member kwd-sym 'c-flat-decl-block-kwds) (push 0 s)))) - ;; The failing `c-syntactic-re-search-forward' may have left us in the - ;; middle of a token, which might be a significant token. Fix this! - (c-beginning-of-current-token) + (when (> prev-match-pos 1) ; Has the search matched at least once? + ;; The failing `c-syntactic-re-search-forward' may have left us in the + ;; middle of a token, which might be a significant token. Fix this! + (c-beginning-of-current-token)) (cons (point) (cons bound-<> s))))) -- Alan Mackenzie (Nuremberg, Germany).