GNU bug report logs - #47457
28.0.50; Infinite loop in cc-mode/isearch

Previous Next

Package: emacs;

Reported by: David Welch <davidwelch158 <at> hotmail.com>

Date: Mon, 29 Mar 2021 01:55:02 UTC

Severity: normal

Found in version 28.0.50

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 47457 in the body.
You can then email your comments to 47457 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#47457; Package emacs. (Mon, 29 Mar 2021 01:55:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to David Welch <davidwelch158 <at> hotmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 29 Mar 2021 01:55:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Welch <davidwelch158 <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: 28.0.50; Infinite loop in cc-mode/isearch
Date: Mon, 29 Mar 2021 01:39:03 +0000
[Message part 1 (text/plain, inline)]
Reproduction:
        Run: emacs -Q ccmode-1.cpp
        Enter: C-S (isearch)
        Enter: yyyyI
        emacs hangs at this point.

It seems to be very dependent on the number of lines displayed in the
frame. It reproduces for me at fullscreen (54 lines) but not in a
smaller window.

The backtrace at the hang is:-

  c-looking-at-inexpr-block(538 nil t)
  c-beginning-of-statement-1(538 nil t)
  c-beginning-of-decl-1(538)
  font-lock-fontify-keywords-region(2003 2126 nil)
  font-lock-default-fontify-region(2003 2126 nil)
  funcall(font-lock-default-fontify-region 2003 2126 nil)
  c-font-lock-fontify-region(2024 2126 nil)
  font-lock-fontify-region(2024 2126)
  #f(compiled-function (fun) #<bytecode -0x1557681c5c448d3b>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode -0x1557681c5c448d3b>) font-lock-fontify-region)
  jit-lock--run-functions(2024 2126)
  jit-lock-fontify-now(2024 2524)
  jit-lock-function(2024)
  redisplay_internal\ \(C\ function\)()
  redisplay()
  sit-for(0)
  isearch-lazy-highlight-new-loop()
  isearch-update()
  isearch-search-and-update()
  isearch-process-search-string("I" "I")
  isearch-process-search-char(73 1)
  isearch-printing-char(73 1)
  funcall-interactively(isearch-printing-char 73 1)
  call-interactively(isearch-printing-char nil nil)
  command-execute(isearch-printing-char)

The loop is in this part of c-looking-at-inexpr-block

    ;; Search for a C++11 "->" which suggests a lambda declaration.
      (when (and (c-major-mode-is 'c++-mode)
(setq haskell-op-pos
      (save-excursion
(while
    (progn
      (c-syntactic-skip-backward "^;=}>" closest-lim t)
      (and (eq (char-before) ?>)
   (c-backward-token-2)
   (not (looking-at c-haskell-op-re)))))
(and (looking-at c-haskell-op-re)
     (point)))))
(goto-char haskell-op-pos))


    (point) is 9 on entry to the function then c-syntactic-skip-backward
    sets it to 538(=limit) and then the while loop repeats infinitely.

I bisected it to the git commit 92c56300c317c9e5573dca787a2cf20f777b317,
in particular this change.

@@ -5481,7 +5492,7 @@ c-syntactic-skip-backward
             (progn
               ;; Skip syntactic ws afterwards so that we don't stop at the
               ;; end of a comment if `skip-chars' is something like "^/".
-              (c-backward-syntactic-ws)
+              (c-backward-syntactic-ws limit)
               (point)))))



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)
 of 2021-03-29 built on david-welch
Repository revision: ee3a4e3d1be656cd0df71ed197dc5f102556f0e0
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.5 LTS

Configured using:
 'configure --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets=yes
 --prefix=/home/dw/devel/emacs/install_latest
 --sharedstatedir=/home/dw/devel/emacs/install_latest/var/lib
 --with-modules=yes'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv 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-langs
cc-bytecomp misearch multi-isearch cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs vc-git diff-mode
easy-mmode vc-dispatcher cl-loaddefs cl-lib jka-compr iso-transl tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer 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
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 121289 6866)
 (symbols 48 10033 1)
 (strings 32 28030 1947)
 (string-bytes 1 980939)
 (vectors 16 16597)
 (vector-slots 8 207848 8652)
 (floats 8 24 45)
 (intervals 56 226 0)
 (buffers 992 11))

[Message part 2 (text/html, inline)]
[ccmode-1.cpp (text/x-c++src, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47457; Package emacs. (Mon, 29 Mar 2021 16:38:02 GMT) Full text and rfc822 format available.

Message #8 received at submit <at> debbugs.gnu.org (full text, mbox):

From: David Welch <davidwelch158 <at> hotmail.com>
To: "bug-gnu-emacs <at> gnu.org" <bug-gnu-emacs <at> gnu.org>
Subject: Re: 28.0.50; Infinite loop in cc-mode/isearch
Date: Mon, 29 Mar 2021 16:37:17 +0000
[Message part 1 (text/plain, inline)]
This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb

________________________________
From: David Welch
Sent: 29 March 2021 02:39
To: bug-gnu-emacs <at> gnu.org <bug-gnu-emacs <at> gnu.org>
Subject: 28.0.50; Infinite loop in cc-mode/isearch

Reproduction:
        Run: emacs -Q ccmode-1.cpp
        Enter: C-S (isearch)
        Enter: yyyyI
        emacs hangs at this point.

It seems to be very dependent on the number of lines displayed in the
frame. It reproduces for me at fullscreen (54 lines) but not in a
smaller window.

The backtrace at the hang is:-

  c-looking-at-inexpr-block(538 nil t)
  c-beginning-of-statement-1(538 nil t)
  c-beginning-of-decl-1(538)
  font-lock-fontify-keywords-region(2003 2126 nil)
  font-lock-default-fontify-region(2003 2126 nil)
  funcall(font-lock-default-fontify-region 2003 2126 nil)
  c-font-lock-fontify-region(2024 2126 nil)
  font-lock-fontify-region(2024 2126)
  #f(compiled-function (fun) #<bytecode -0x1557681c5c448d3b>)(font-lock-fontify-region)
  run-hook-wrapped(#f(compiled-function (fun) #<bytecode -0x1557681c5c448d3b>) font-lock-fontify-region)
  jit-lock--run-functions(2024 2126)
  jit-lock-fontify-now(2024 2524)
  jit-lock-function(2024)
  redisplay_internal\ \(C\ function\)()
  redisplay()
  sit-for(0)
  isearch-lazy-highlight-new-loop()
  isearch-update()
  isearch-search-and-update()
  isearch-process-search-string("I" "I")
  isearch-process-search-char(73 1)
  isearch-printing-char(73 1)
  funcall-interactively(isearch-printing-char 73 1)
  call-interactively(isearch-printing-char nil nil)
  command-execute(isearch-printing-char)

The loop is in this part of c-looking-at-inexpr-block

    ;; Search for a C++11 "->" which suggests a lambda declaration.
      (when (and (c-major-mode-is 'c++-mode)
(setq haskell-op-pos
      (save-excursion
(while
    (progn
      (c-syntactic-skip-backward "^;=}>" closest-lim t)
      (and (eq (char-before) ?>)
   (c-backward-token-2)
   (not (looking-at c-haskell-op-re)))))
(and (looking-at c-haskell-op-re)
     (point)))))
(goto-char haskell-op-pos))


    (point) is 9 on entry to the function then c-syntactic-skip-backward
    sets it to 538(=limit) and then the while loop repeats infinitely.

I bisected it to the git commit 92c56300c317c9e5573dca787a2cf20f777b317,
in particular this change.

@@ -5481,7 +5492,7 @@ c-syntactic-skip-backward
             (progn
               ;; Skip syntactic ws afterwards so that we don't stop at the
               ;; end of a comment if `skip-chars' is something like "^/".
-              (c-backward-syntactic-ws)
+              (c-backward-syntactic-ws limit)
               (point)))))



In GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.22.30, cairo version 1.15.10)
 of 2021-03-29 built on david-welch
Repository revision: ee3a4e3d1be656cd0df71ed197dc5f102556f0e0
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.11906000
System Description: Ubuntu 18.04.5 LTS

Configured using:
 'configure --with-x=yes --with-x-toolkit=gtk3 --with-xwidgets=yes
 --prefix=/home/dw/devel/emacs/install_latest
 --sharedstatedir=/home/dw/devel/emacs/install_latest/var/lib
 --with-modules=yes'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY
INOTIFY PDUMPER PNG RSVG SOUND THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE
XIM XPM XWIDGETS GTK3 ZLIB

Important settings:
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Lisp Interaction

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

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
rfc822 mml mml-sec epa derived epg epg-config gnus-util rmail
rmail-loaddefs auth-source cl-seq eieio eieio-core cl-macs
eieio-loaddefs password-cache json map text-property-search time-date
subr-x seq byte-opt gv bytecomp byte-compile cconv 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-langs
cc-bytecomp misearch multi-isearch cc-mode cc-fonts cc-guess cc-menus
cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs vc-git diff-mode
easy-mmode vc-dispatcher cl-loaddefs cl-lib jka-compr iso-transl tooltip
eldoc electric uniquify ediff-hook vc-hooks lisp-float-type mwheel
term/x-win x-win term/common-win x-dnd tool-bar dnd fontset image
regexp-opt fringe tabulated-list replace newcomment text-mode elisp-mode
lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch
easymenu timer select scroll-bar mouse jit-lock font-lock syntax
font-core term/tty-colors frame minibuffer 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
cl-preloaded nadvice button loaddefs faces cus-face macroexp files
window text-properties overlay sha1 md5 base64 format env code-pages
mule custom widget hashtable-print-readable backquote threads
xwidget-internal dbusbind inotify lcms2 dynamic-setting
system-font-setting font-render-setting cairo move-toolbar gtk x-toolkit
x multi-tty make-network-process emacs)

Memory information:
((conses 16 121289 6866)
 (symbols 48 10033 1)
 (strings 32 28030 1947)
 (string-bytes 1 980939)
 (vectors 16 16597)
 (vector-slots 8 207848 8652)
 (floats 8 24 45)
 (intervals 56 226 0)
 (buffers 992 11))

[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#47457; Package emacs. (Mon, 29 Mar 2021 16:38:02 GMT) Full text and rfc822 format available.

Message #11 received at 47457 <at> debbugs.gnu.org (full text, mbox):

From: David Welch <davidwelch158 <at> hotmail.com>
To: "47457 <at> debbugs.gnu.org" <47457 <at> debbugs.gnu.org>
Subject: Re: bug#47457: Acknowledgement (28.0.50; Infinite loop in
 cc-mode/isearch)
Date: Mon, 29 Mar 2021 16:37:03 +0000
[Message part 1 (text/plain, inline)]
This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb.

________________________________
From: GNU bug Tracking System <help-debbugs <at> gnu.org>
Sent: 29 March 2021 02:55
To: David Welch <davidwelch158 <at> hotmail.com>
Subject: bug#47457: Acknowledgement (28.0.50; Infinite loop in cc-mode/isearch)

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
 bug-gnu-emacs <at> gnu.org

If you wish to submit further information on this problem, please
send it to 47457 <at> debbugs.gnu.org.

Please do not send mail to help-debbugs <at> gnu.org unless you wish
to report a problem with the Bug-tracking system.

--
47457: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=47457
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (text/html, inline)]

Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Mon, 29 Mar 2021 17:03:01 GMT) Full text and rfc822 format available.

Notification sent to David Welch <davidwelch158 <at> hotmail.com>:
bug acknowledged by developer. (Mon, 29 Mar 2021 17:03:02 GMT) Full text and rfc822 format available.

Message #16 received at 47457-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: David Welch <davidwelch158 <at> hotmail.com>
Cc: 47457-done <at> debbugs.gnu.org
Subject: Re: bug#47457: 28.0.50; Infinite loop in cc-mode/isearch
Date: Mon, 29 Mar 2021 20:02:45 +0300
> From: David Welch <davidwelch158 <at> hotmail.com>
> Date: Mon, 29 Mar 2021 16:37:17 +0000
> 
> This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb

Thanks, closing.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 27 Apr 2021 11:24:07 GMT) Full text and rfc822 format available.

This bug report was last modified 2 years and 357 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.