all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#47457: 28.0.50; Infinite loop in cc-mode/isearch
@ 2021-03-29  1:39 David Welch
       [not found] ` <handler.47457.B.161698285915063.ack@debbugs.gnu.org>
  2021-03-29 16:37 ` bug#47457: 28.0.50; Infinite loop in cc-mode/isearch David Welch
  0 siblings, 2 replies; 4+ messages in thread
From: David Welch @ 2021-03-29  1:39 UTC (permalink / raw)
  To: 47457


[-- Attachment #1.1: Type: text/plain, Size: 5878 bytes --]

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))


[-- Attachment #1.2: Type: text/html, Size: 8818 bytes --]

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: ccmode-1.cpp --]
[-- Type: text/x-c++src; name="ccmode-1.cpp", Size: 2125 bytes --]

class a
{
public:
	template<typename T>
	void fffffFf()
	{
	}

	template<typename T, typename std::enable_if<!std::is_pointer<T>::eeeee &&
	                                             !std::is_enum<T>::eeeee>::type* = nullptr>
	const T& yyyy()
	{
		xxxxxXx<T>();
		const bbbb_b xxxxxxxXxxxxx = gGggggg;
		xxxxxxx(sizeof(T));
		return *reinterpret_cast<const T*>(XxxxXxxxxx<const T>(mZzzzzz, xxxxxxxXxxxxx));
	}

	template<typename T, typename std::enable_if<std::is_enum<T>::eeeee>::type* = nullptr>
	T yyyy()
	{
		return static_cast<T>(yyyy<int32_t>());
	}

	/// XxxxxxxxxxxxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	template<typename T>
	void yyyy(T& val)
	{
		val = yyyy<T>();
	}

	/// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	template<typename T>
	T* yyyyZzzzzz(bbbb_b wwwwWwwww)
	{
		T* ppp = jJjjjj.get<T>(wwwwWwwww);
		yyyyZzzzzz(out, wwwwWwwww);
		return out;
	}

	/// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	template<typename T>
	void yyyyHhhhh(T*& ppp, bbbb_b pppp)
	{
		qqq = yyyyZzzzzz<T>(pppp * sizeof(T));
	}

	/// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	template<typename T, typename std::enable_if<std::is_array<T>::eeeee>::type* = nullptr>
	void yyyyHhhhh(T& kkkkk)
	{
		yyyyZzzzzz(kkkkk, std::extent<T>::eeeee * sizeof(typename std::remove_extent<T>::type));
	}

	/// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	bbbb_b aaaaaa() { return std::aaaaaa(currentPtr<const char>()); }

	/// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
	void yyyyIiiiii(char*& str)
	{
		const bbbb_b lll = aaaaaa() + 1; // we always yyyy at least the '\0'
		str = yyyyHhhhh<char>(lll);
	}
};

/// XxxxxxxXxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
template<typename T>
class XxxXxxxx final
{
private:
	T* const xXxxx;
	const bbbb_b xXxxx;

	XxxXxxxx() = delete;

public:
	explicit XxxXxxxx(T* cccc, bbbb_b dddd) : xXxxx(cccc), xXxxx(dddd) {}

	T* begin() { return xXxxx; }

	T* end() { return (xXxxx + xXxxx); }
};

/// Xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
template<typename T>
XxxXxxxx<T> Range(T* cccc, bbbb_b dddd)
{
	return XxxXxxxx<T>(cccc, dddd);
}
} // xxxxxxxxxxxxxxxxxxx

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#47457: Acknowledgement (28.0.50; Infinite loop in cc-mode/isearch)
       [not found] ` <handler.47457.B.161698285915063.ack@debbugs.gnu.org>
@ 2021-03-29 16:37   ` David Welch
  0 siblings, 0 replies; 4+ messages in thread
From: David Welch @ 2021-03-29 16:37 UTC (permalink / raw)
  To: 47457@debbugs.gnu.org

[-- Attachment #1: Type: text/plain, Size: 1055 bytes --]

This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb.

________________________________
From: GNU bug Tracking System <help-debbugs@gnu.org>
Sent: 29 March 2021 02:55
To: David Welch <davidwelch158@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@gnu.org

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

Please do not send mail to help-debbugs@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@gnu.org with problems

[-- Attachment #2: Type: text/html, Size: 2039 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#47457: 28.0.50; Infinite loop in cc-mode/isearch
  2021-03-29  1:39 bug#47457: 28.0.50; Infinite loop in cc-mode/isearch David Welch
       [not found] ` <handler.47457.B.161698285915063.ack@debbugs.gnu.org>
@ 2021-03-29 16:37 ` David Welch
  2021-03-29 17:02   ` Eli Zaretskii
  1 sibling, 1 reply; 4+ messages in thread
From: David Welch @ 2021-03-29 16:37 UTC (permalink / raw)
  To: 47457

[-- Attachment #1: Type: text/plain, Size: 6136 bytes --]

This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb

________________________________
From: David Welch
Sent: 29 March 2021 02:39
To: bug-gnu-emacs@gnu.org <bug-gnu-emacs@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))


[-- Attachment #2: Type: text/html, Size: 9566 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* bug#47457: 28.0.50; Infinite loop in cc-mode/isearch
  2021-03-29 16:37 ` bug#47457: 28.0.50; Infinite loop in cc-mode/isearch David Welch
@ 2021-03-29 17:02   ` Eli Zaretskii
  0 siblings, 0 replies; 4+ messages in thread
From: Eli Zaretskii @ 2021-03-29 17:02 UTC (permalink / raw)
  To: David Welch; +Cc: 47457-done

> From: David Welch <davidwelch158@hotmail.com>
> Date: Mon, 29 Mar 2021 16:37:17 +0000
> 
> This is fixed by  git commit 1440dbed544a76ee3b876cb573b5110211e798bb

Thanks, closing.





^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-29 17:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-03-29  1:39 bug#47457: 28.0.50; Infinite loop in cc-mode/isearch David Welch
     [not found] ` <handler.47457.B.161698285915063.ack@debbugs.gnu.org>
2021-03-29 16:37   ` bug#47457: Acknowledgement (28.0.50; Infinite loop in cc-mode/isearch) David Welch
2021-03-29 16:37 ` bug#47457: 28.0.50; Infinite loop in cc-mode/isearch David Welch
2021-03-29 17:02   ` Eli Zaretskii

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.