bug#47457: 28.0.50; Infinite loop in cc-mode/isearch

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

bug#47457: 28.0.50; Infinite loop in cc-mode/isearch

David Welch
This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb


From: David Welch
Sent: 29 March 2021 02:39
To: [hidden email] <[hidden email]>
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))

Reply | Threaded
Open this post in threaded view
|

bug#47457: 28.0.50; Infinite loop in cc-mode/isearch

Eli Zaretskii
> From: David Welch <[hidden email]>
> Date: Mon, 29 Mar 2021 16:37:17 +0000
>
> This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb

Thanks, closing.