unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#29024: CC-mode infinite loop on typing < in template spec
@ 2017-10-27  7:28 Richard Copley
  2017-10-27  7:40 ` Richard Copley
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Copley @ 2017-10-27  7:28 UTC (permalink / raw)
  To: 29024

In an empty CC-mode buffer, after typing "template <", Emacs enters an
infinite loop.

This was asked about here:
<https://emacs.stackexchange.com/questions/36423/emacs-hangs-on-c-mode-when-writting-the-character>
and reported on the emacs-devel list here:
<http://lists.gnu.org/archive/html/emacs-devel/2017-10/msg00809.html>.

Recipe:

1. Visit an empty or non-existent .cpp file
2. Type "template <". Emacs hangs.

To trigger the bug again,
3. M-x erase-buffer RET
4. M-x normal-mode RET
5. Go to step 2.

The Emacs-lisp backtrace on quit is:

Debugger entered--Lisp error: (quit)
  c-forward-<>-arglist-recur(nil)
  c-forward-<>-arglist(nil)
  c-restore-<>-properties(10 11 0)
  #f(compiled-function (fn) #<bytecode 0x22e5bad>)(c-restore-<>-properties)
  mapc(#f(compiled-function (fn) #<bytecode 0x22e5bad>)
(c-depropertize-new-text c-parse-quotes-after-change
c-extend-font-lock-region-for-macros
c-after-change-re-mark-raw-strings c-neutralize-syntax-in-and-mark-CPP
c-restore-<>-properties c-change-expand-fl-region))
  c-after-change(10 11 0)
  self-insert-command(1)
  c-electric-lt-gt(nil)
  funcall-interactively(c-electric-lt-gt nil)
  call-interactively(c-electric-lt-gt nil nil)
  command-execute(c-electric-lt-gt)

In GNU Emacs 26.0.90 (build 1, x86_64-w64-mingw32)
 of 2017-10-13 built on MACHINE
Repository revision: d79fbb1818dc442ce71e7b55a8f1a4995d6fcd9e
Windowing system distributor 'Microsoft Corp.', version 10.0.15063
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
Debug on Quit enabled globally
Entering debugger...

Configured using:
 'configure --config-cache --with-modules --without-pop 'CFLAGS=-O3
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES LCMS2

Important settings:
  value of $EMACSLOADPATH: c:\emacs-lisp;
  value of $LANG: en_GB.UTF-8
  locale-coding-system: cp1252

Major mode: Debugger

Minor modes in effect:
  tooltip-mode: t
  global-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
  buffer-read-only: t
  line-number-mode: t
  transient-mark-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug message rmc puny seq dired
dired-loaddefs format-spec rfc822 mml mml-sec password-cache epa derived
epg epg-config gnus-util rmail 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 help-mode
cl-print byte-opt gv bytecomp byte-compile cconv debug cus-start
cus-load cc-mode cc-fonts easymenu cc-guess cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs cl-loaddefs cl-lib elec-pair
time-date mule-util tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel dos-w32 ls-lisp disp-table term/w32-win w32-win
w32-vars term/common-win tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode elisp-mode lisp-mode
prog-mode register page menu-bar rfn-eshadow isearch timer select
scroll-bar 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 w32notify w32 lcms2 multi-tty make-network-process emacs)

Memory information:
((conses 16 125933 9286)
 (symbols 56 23532 1)
 (miscs 48 69 106)
 (strings 32 37375 1623)
 (string-bytes 1 1065619)
 (vectors 16 17502)
 (vector-slots 8 519143 6247)
 (floats 8 58 316)
 (intervals 56 311 17)
 (buffers 992 13))





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27  7:28 bug#29024: CC-mode infinite loop on typing < in template spec Richard Copley
@ 2017-10-27  7:40 ` Richard Copley
  2017-10-27  8:28   ` Eli Zaretskii
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Copley @ 2017-10-27  7:40 UTC (permalink / raw)
  To: 29024, GNU bug tracker automated control server

merge 28926 29024
thanks

#29024 appears to be the same bug as #28926.





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27  7:40 ` Richard Copley
@ 2017-10-27  8:28   ` Eli Zaretskii
  2017-10-27  8:33     ` Eli Zaretskii
  2017-10-27 13:40     ` Alan Mackenzie
  0 siblings, 2 replies; 8+ messages in thread
From: Eli Zaretskii @ 2017-10-27  8:28 UTC (permalink / raw)
  To: Richard Copley; +Cc: Alan Mackenzie, 29024

> From: Richard Copley <rcopley@gmail.com>
> Date: Fri, 27 Oct 2017 08:40:45 +0100
> 
> #29024 appears to be the same bug as #28926.

Strangely enough, with today's emacs-26 branch, I cannot reproduce
either of those two recipes.  I can reproduce them with stock 26.0.90
pretest, though.  Maybe this only happens in optimized builds?

Alan, are you looking into this?

Thanks.





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27  8:28   ` Eli Zaretskii
@ 2017-10-27  8:33     ` Eli Zaretskii
  2017-10-27 12:01       ` Richard Copley
  2017-10-27 13:40     ` Alan Mackenzie
  1 sibling, 1 reply; 8+ messages in thread
From: Eli Zaretskii @ 2017-10-27  8:33 UTC (permalink / raw)
  To: rcopley; +Cc: acm, 29024

> Date: Fri, 27 Oct 2017 11:28:47 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> Cc: Alan Mackenzie <acm@muc.de>, 29024@debbugs.gnu.org
> 
> > From: Richard Copley <rcopley@gmail.com>
> > Date: Fri, 27 Oct 2017 08:40:45 +0100
> > 
> > #29024 appears to be the same bug as #28926.
> 
> Strangely enough, with today's emacs-26 branch, I cannot reproduce
> either of those two recipes.  I can reproduce them with stock 26.0.90
> pretest, though.  Maybe this only happens in optimized builds?

It would be good if you could try in the latest branch HEAD, your
build seems 2 weeks behind it.  Then we'd know if the bug was somehow
already fixed.

Thanks.





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27  8:33     ` Eli Zaretskii
@ 2017-10-27 12:01       ` Richard Copley
  2017-10-27 12:06         ` Richard Copley
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Copley @ 2017-10-27 12:01 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alan Mackenzie, 29024

On 27 October 2017 at 09:33, Eli Zaretskii <eliz@gnu.org> wrote:
>> Date: Fri, 27 Oct 2017 11:28:47 +0300
>> From: Eli Zaretskii <eliz@gnu.org>
>> Cc: Alan Mackenzie <acm@muc.de>, 29024@debbugs.gnu.org
>>
>> > From: Richard Copley <rcopley@gmail.com>
>> > Date: Fri, 27 Oct 2017 08:40:45 +0100
>> >
>> > #29024 appears to be the same bug as #28926.
>>
>> Strangely enough, with today's emacs-26 branch, I cannot reproduce
>> either of those two recipes.  I can reproduce them with stock 26.0.90
>> pretest, though.  Maybe this only happens in optimized builds?
>
> It would be good if you could try in the latest branch HEAD, your
> build seems 2 weeks behind it.  Then we'd know if the bug was somehow
> already fixed.
>
> Thanks.

Thanks, perhaps so. Not reproducible in my latest build.
(This is built and run on a different computer, using Windows 7
not Windows 10, but I don't suppose that's likely to make a difference.)

In GNU Emacs 26.0.90 (build 1, x86_64-w64-mingw32)
 of 2017-10-27 built on [redacted]
Repository revision: 1e9f599b1fe1b25a69a80f5a8e0cb81b789ade82
Windowing system distributor 'Microsoft Corp.', version 6.1.7601
Recent messages:
For information about GNU Emacs and the GNU system, type C-h C-a.
(New file)

Configured using:
 'configure --config-cache --with-modules --without-pop 'CFLAGS=-O3
 -ggdb3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES LCMS2





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27 12:01       ` Richard Copley
@ 2017-10-27 12:06         ` Richard Copley
  2017-10-27 12:21           ` Noam Postavsky
  0 siblings, 1 reply; 8+ messages in thread
From: Richard Copley @ 2017-10-27 12:06 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Alan Mackenzie, 29024

On 27 October 2017 at 13:01, Richard Copley <rcopley@gmail.com> wrote:
> On 27 October 2017 at 09:33, Eli Zaretskii <eliz@gnu.org> wrote:

> Not reproducible in my latest build.
[...]
> Repository revision: 1e9f599b1fe1b25a69a80f5a8e0cb81b789ade82

That's fsf/emacs-26 53aaad1dfc1f9e0ffe7ee457967426584cd7f541
of Fri Oct 27 01:14:17 2017, plus irrelevant local patches.





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27 12:06         ` Richard Copley
@ 2017-10-27 12:21           ` Noam Postavsky
  0 siblings, 0 replies; 8+ messages in thread
From: Noam Postavsky @ 2017-10-27 12:21 UTC (permalink / raw)
  To: Richard Copley; +Cc: Alan Mackenzie, 29024

tags 29024 fixed
close 29024
quit

Richard Copley <rcopley@gmail.com> writes:

> On 27 October 2017 at 13:01, Richard Copley <rcopley@gmail.com> wrote:
>> On 27 October 2017 at 09:33, Eli Zaretskii <eliz@gnu.org> wrote:
>
>> Not reproducible in my latest build.
> [...]
>> Repository revision: 1e9f599b1fe1b25a69a80f5a8e0cb81b789ade82
> That's fsf/emacs-26 53aaad1dfc1f9e0ffe7ee457967426584cd7f541
> of Fri Oct 27 01:14:17 2017, plus irrelevant local patches.

It's fixed by [1: b7c4aa951c], I can reproduce only with the previous
commit.

[1: b7c4aa951c]: 2017-10-22 14:18:20 +0000
  Refactor c-forward-token-2 with new function c-forward-over-token-and-ws.
  https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=b7c4aa951c8b12629742df9d20d6374c3d2a8ba8>





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

* bug#29024: CC-mode infinite loop on typing < in template spec
  2017-10-27  8:28   ` Eli Zaretskii
  2017-10-27  8:33     ` Eli Zaretskii
@ 2017-10-27 13:40     ` Alan Mackenzie
  1 sibling, 0 replies; 8+ messages in thread
From: Alan Mackenzie @ 2017-10-27 13:40 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Richard Copley, 29024

Hello, Eli.

On Fri, Oct 27, 2017 at 11:28:47 +0300, Eli Zaretskii wrote:
> > From: Richard Copley <rcopley@gmail.com>
> > Date: Fri, 27 Oct 2017 08:40:45 +0100

> > #29024 appears to be the same bug as #28926.

> Strangely enough, with today's emacs-26 branch, I cannot reproduce
> either of those two recipes.  I can reproduce them with stock 26.0.90
> pretest, though.  Maybe this only happens in optimized builds?

> Alan, are you looking into this?

I think I fixed it last Sunday (though I haven't checked properly yet),
with the following commit to the emacs-26 branch:

  commit b7c4aa951c8b12629742df9d20d6374c3d2a8ba8
  Date:   Sun Oct 22 14:18:20 2017 +0000

  Refactor c-forward-token-2 with new function c-forward-over-token-and-ws.

  Use the new function directly in several places where c-forward-token-2
  wouldn't move over the last token in the buffer.  This caused an infinite loop
  in c-restore-<>-properties.

Though, with the benefit of hindsight, the top line of the commit message
wasn't as helpful as it might have been.

Again, regrets that the bug happened at all.

-- 
Alan Mackenzie (Nuremberg, Germany).





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

end of thread, other threads:[~2017-10-27 13:40 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-27  7:28 bug#29024: CC-mode infinite loop on typing < in template spec Richard Copley
2017-10-27  7:40 ` Richard Copley
2017-10-27  8:28   ` Eli Zaretskii
2017-10-27  8:33     ` Eli Zaretskii
2017-10-27 12:01       ` Richard Copley
2017-10-27 12:06         ` Richard Copley
2017-10-27 12:21           ` Noam Postavsky
2017-10-27 13:40     ` Alan Mackenzie

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).