GNU bug report logs - #7722
24.0.50; Finding this C++ header file drops emacs into a infinite loop

Previous Next

Packages: emacs, cc-mode;

Reported by: Tassilo Horn <tassilo <at> member.fsf.org>

Date: Fri, 24 Dec 2010 08:23:01 UTC

Severity: serious

Found in version 24.0.50

Fixed in version 24.1

Done: Glenn Morris <rgm <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Chong Yidong <cyd <at> stupidchicken.com>
To: Alan Mackenzie <acm <at> muc.de>
Cc: 7722 <at> debbugs.gnu.org, Tassilo Horn <tassilo <at> member.fsf.org>
Subject: bug#7722: 24.0.50; Finding this C++ header file drops emacs into a infinite loop
Date: Wed, 26 Jan 2011 19:55:15 -0500
Chong Yidong <cyd <at> stupidchicken.com> writes:

>> 1. emacs -Q bug.hpp
>> 2. emacs loops infinitely using 100% CPU resources
>>
>> The offending file is that (according to the original reporter, the
>> spaces and empty lines are needed):
>
> I can reproduce this (file attached for convenience).  Alan, could you
> take a look?  Looks like a loop in c-forward-<>-arglist-recur:

In the meantime, I have added the following hack/workaround to the
emacs-23 branch, which seems to break the loop.  Let me know if you find
a fix that's safer (since we are well into the 23.3 pretest).

*** lisp/progmodes/cc-engine.el	2011-01-02 23:50:46 +0000
--- lisp/progmodes/cc-engine.el	2011-01-27 00:49:22 +0000
***************
*** 4393,4398 ****
--- 4393,4400 ----
        (goto-char safe-pos)
        t)))
  
+ (defvar c-forward-<>-arglist-recur-depth)
+ 
  (defun c-forward-<>-arglist (all-types)
    ;; The point is assumed to be at a "<".  Try to treat it as the open
    ;; paren of an angle bracket arglist and move forward to the
***************
*** 4418,4424 ****
  	;; If `c-record-type-identifiers' is set then activate
  	;; recording of any found types that constitute an argument in
  	;; the arglist.
! 	(c-record-found-types (if c-record-type-identifiers t)))
      (if (catch 'angle-bracket-arglist-escape
  	  (setq c-record-found-types
  		(c-forward-<>-arglist-recur all-types)))
--- 4420,4427 ----
  	;; If `c-record-type-identifiers' is set then activate
  	;; recording of any found types that constitute an argument in
  	;; the arglist.
! 	(c-record-found-types (if c-record-type-identifiers t))
! 	(c-forward-<>-arglist-recur--depth 0))
      (if (catch 'angle-bracket-arglist-escape
  	  (setq c-record-found-types
  		(c-forward-<>-arglist-recur all-types)))
***************
*** 4434,4439 ****
--- 4437,4450 ----
        nil)))
  
  (defun c-forward-<>-arglist-recur (all-types)
+ 
+   ;; Temporary workaround for Bug#7722.
+   (when (boundp 'c-forward-<>-arglist-recur--depth)
+     (if (> c-forward-<>-arglist-recur--depth 100)
+ 	(error "Max recursion depth reached in <> arglist")
+       (setq c-forward-<>-arglist-recur--depth
+ 	    (1+ c-forward-<>-arglist-recur--depth))))
+ 
    ;; Recursive part of `c-forward-<>-arglist'.
    ;;
    ;; This function might do hidden buffer changes.





This bug report was last modified 14 years and 21 days ago.

Previous Next


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