all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Alan Mackenzie <acm@muc.de>
To: Eli Zaretskii <eliz@gnu.org>
Cc: psainty@orcon.net.nz, gerd.moellmann@gmail.com,
	Gregory Heytings <gregory@heytings.org>,
	59038@debbugs.gnu.org, checker@d6.com
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	[thread overview]
Message-ID: <Y2fiMTlfuNqae7zp@ACM> (raw)
In-Reply-To: <83iljs197i.fsf@gnu.org>

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 <gregory@heytings.org>
> > cc: Eli Zaretskii <eliz@gnu.org>, 
> >     Gerd Möllmann <gerd.moellmann@gmail.com>, 
> >     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).





  reply	other threads:[~2022-11-06 16:34 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-05  2:48 bug#59038: loading this base64 file makes emacs -Q 28.2 peg a core infinitely Chris Hecker
2022-11-05  5:12 ` Gerd Möllmann
2022-11-05  7:01   ` Eli Zaretskii
2022-11-05  7:50     ` Gerd Möllmann
2022-11-05  8:21       ` Chris Hecker
2022-11-05  8:45         ` Gerd Möllmann
2022-11-05  9:30         ` Eli Zaretskii
2022-11-05 10:39           ` bug#59038: Re[2]: " Chris Hecker
2022-11-05 11:29         ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-11-05 15:01           ` Chris Hecker
2022-11-06  5:17             ` Gerd Möllmann
2022-11-05 22:03           ` Alan Mackenzie
2022-11-06  6:00             ` Eli Zaretskii
2022-11-05  9:28       ` Eli Zaretskii
2022-11-06  5:18         ` Gerd Möllmann
2022-11-05 22:27     ` Gregory Heytings
2022-11-05 23:41       ` Gregory Heytings
2022-11-06  3:58         ` Phil Sainty
2022-11-06  5:20           ` Gerd Möllmann
2022-11-06 13:54             ` Alan Mackenzie
2022-11-06  9:18           ` Gregory Heytings
2022-11-06 13:52             ` Eli Zaretskii
2022-11-06 16:34               ` Alan Mackenzie [this message]
2022-11-07  7:55                 ` Gerd Möllmann
     [not found]               ` <Y2fiMTlfuNqae7zp@acm>
2022-11-06 19:46                 ` bug#59038: Re[2]: " Chris Hecker
2022-11-07 12:25                   ` Alan Mackenzie
2022-11-05  6:52 ` Eli Zaretskii
2022-11-05 10:45 ` Phil Sainty

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Y2fiMTlfuNqae7zp@ACM \
    --to=acm@muc.de \
    --cc=59038@debbugs.gnu.org \
    --cc=checker@d6.com \
    --cc=eliz@gnu.org \
    --cc=gerd.moellmann@gmail.com \
    --cc=gregory@heytings.org \
    --cc=psainty@orcon.net.nz \
    /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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.