Subject: bug#34186: closed (Re: bug#34186: 26.1; locking up)

From: [email-masked] (GNU bug Tracking System)
Date: Fri, 25 Jan 2019 16:31:02 +0000

Your bug report

#34186: 26.1; locking up

which was filed against the emacs,cc-mode package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
34186: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=34186
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#34186: 26.1; locking up
From: Alan Mackenzie <[email-masked]>
To: Eli Zaretskii <[email-masked]>, Michael Menefee <[email-masked]>
Cc: [email-masked]
Date: Fri, 25 Jan 2019 16:30:07 +0000
List-Id: <debbugs-submit.debbugs.gnu.org>

Hello, Eli and Michael.

On Thu, Jan 24, 2019 at 19:41:21 +0200, Eli Zaretskii wrote:
> > From: Michael Menefee <[email-masked]>
> > Date: Thu, 24 Jan 2019 10:32:34 -0600
> > Cc: [email-masked]

> > I have found the minimum necessary to consistently reproduce.  copy/paste this into something.c to see if you
> > get same results:

> > void *AVL_first(AVL_t *);
> > void *AVL_last(AVL_t *);
> > #define (<--- locks up with pressing open parenthesis

> Thanks, now I can reproduce this.  Alan, please take a look.

I've committed the following fix to the emacs-26 branch.  I'm closing
the bug.

@Michael: This patch should apply cleanly to your Emacs 26.1 version (in
directory .../emacs/lisp/progmodes).  If you apply it, please
byte-compile the file before using it.  (If you want any help with the
patching and/or byte-compiling, feel free to send me private email.)

commit 9078f34e84178553cd59bc03ac1b58cb56038436
Author: Alan Mackenzie <[email-masked]>
Date:   Fri Jan 25 16:14:00 2019 +0000

    Fix a loop in c-fl-decl-start.  This fixes bug #34186.
    
    * lisp/progmodes/cc-mode.el (c-fl-decl-start) In the pair of operations
    c-syntactic-skip-backward and c-forward-syntactic-ws, ensure the latter
    doesn't come back to the position before the former, and break out of the
    enclosing loop if it does.

diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8cbb4e8612..5283cfea6e 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1487,6 +1487,7 @@ c-fl-decl-start
   ;; lock context (etc.) fontification.
   (goto-char pos)
   (let ((lit-start (c-literal-start))
+	old-pos
 	(new-pos pos)
 	capture-opener
 	bod-lim bo-decl)
@@ -1509,12 +1510,14 @@ c-fl-decl-start
     (while
 	;; Go to a less nested declaration each time round this loop.
 	(and
+	 (setq old-pos (point))
 	 (c-syntactic-skip-backward "^;{}" bod-lim t)
 	 (> (point) bod-lim)
 	 (progn (c-forward-syntactic-ws)
 		;; Have we got stuck in a comment at EOB?
 		(not (and (eobp)
 			  (c-literal-start))))
+	 (< (point) old-pos)
 	 (progn (setq bo-decl (point))
 		(or (not (looking-at c-protection-key))
 		    (c-forward-keyword-clause 1)))

-- 
Alan Mackenzie (Nuremberg, Germany).

Subject: 26.1; locking up
From: Michael Menefee <[email-masked]>
To: [email-masked]
Date: Wed, 23 Jan 2019 10:24:09 -0600
List-Id: <debbugs-submit.debbugs.gnu.org>

Editing a C header file, I type
'#define AVL_iter(' and it locks up consistently and has to be killed
from another terminal, with CPU at 100%.

In GNU Emacs 26.1 (build 1, amd64-portbld-freebsd11.2)
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
avl.h has auto save data; consider M-x recover-this-file
Making completion list...

Configured using:
 'configure --disable-build-details --localstatedir=/var
 --with-gameuser=games:games --with-sound=no --without-cairo
 --without-dbus --without-gconf --without-gif --without-gsettings
 --with-x-toolkit=no --without-jpeg --without-lcms2 --without-m17n-flt
 --without-imagemagick --without-libotf --without-png
 --without-toolkit-scroll-bars --without-rsvg --without-tiff --without-x
 --without-xim --without-xpm --without-xwidgets --enable-acl
 --without-cairo --without-dbus --without-gconf --without-gif
 --with-gnutls --without-gsettings --without-jpeg --with-json
 --with-file-notification=kqueue --without-lcms2 --without-m17n-flt
 --without-imagemagick --with-mailutils --with-modules --without-libotf
 --without-png --without-toolkit-scroll-bars --without-rsvg
 --with-threads --without-tiff --without-xft --without-xim --with-xml2
 --without-xpm --without-xwidgets --with-x-toolkit=no
 --prefix=/usr/local --mandir=/usr/local/man --disable-silent-rules
 --infodir=/usr/local/share/emacs/info/
 --build=amd64-portbld-freebsd11.2 'CFLAGS=-O2 -pipe -fstack-protector
 -isystem /usr/local/include -fno-strict-aliasing ' 'CPPFLAGS=-isystem
 /usr/local/include' 'LDFLAGS= -fstack-protector -L/usr/local/lib ''

Configured features:
NOTIFY ACL GNUTLS LIBXML2 ZLIB MODULES THREADS

Important settings:
  locale-coding-system: nil

Major mode: C/*l

Minor modes in effect:
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t
  abbrev-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq byte-opt gv
bytecomp byte-compile cconv dired dired-loaddefs format-spec rfc822 mml
mml-sec password-cache epa derived epg epg-config gnus-util rmail
tool-bar rmail-loaddefs mm-decode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils cc-mode cc-fonts easymenu cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs regexp-opt
cl-loaddefs cl-lib term/xterm xterm time-date elec-pair disp-table
mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page menu-bar rfn-eshadow isearch timer
select mouse jit-lock font-lock syntax facemenu font-core
term/tty-colors frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese composite charscript charprop case-table epa-hook jka-cmpr-hook
help simple abbrev obarray minibuffer cl-preloaded nadvice loaddefs
button faces cus-face macroexp files text-properties overlay sha1 md5
base64 format env code-pages mule custom widget hashtable-print-readable
backquote kqueue multi-tty make-network-process emacs)

Memory information:
((conses 16 113912 7715)
 (symbols 48 21664 1)
 (miscs 40 37 117)
 (strings 32 33281 1470)
 (string-bytes 1 1017633)
 (vectors 16 14418)
 (vector-slots 8 469218 6278)
 (floats 8 50 318)
 (intervals 56 522 258)
 (buffers 992 13))