From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs 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 Message-ID: <87k4hrcgi4.fsf@stupidchicken.com> References: <87fwtnbmmj.fsf@member.fsf.org> <87hbd0y8sb.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1296091521 4015 80.91.229.12 (27 Jan 2011 01:25:21 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Thu, 27 Jan 2011 01:25:21 +0000 (UTC) Cc: 7722@debbugs.gnu.org, Tassilo Horn To: Alan Mackenzie Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Jan 27 02:25:17 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PiGbr-0006gu-3Y for geb-bug-gnu-emacs@m.gmane.org; Thu, 27 Jan 2011 02:25:15 +0100 Original-Received: from localhost ([127.0.0.1]:46830 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiGbq-0003AE-9w for geb-bug-gnu-emacs@m.gmane.org; Wed, 26 Jan 2011 20:25:14 -0500 Original-Received: from [140.186.70.92] (port=59141 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PiGbl-00039z-2O for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2011 20:25:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PiGbk-0001jk-1t for bug-gnu-emacs@gnu.org; Wed, 26 Jan 2011 20:25:08 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:35293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PiGbh-0001jR-Vg; Wed, 26 Jan 2011 20:25:06 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1PiG1q-0004rp-2e; Wed, 26 Jan 2011 19:48:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Chong Yidong Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org, bug-cc-mode@gnu.org Resent-Date: Thu, 27 Jan 2011 00:48:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 7722 X-GNU-PR-Package: emacs,cc-mode X-GNU-PR-Keywords: Original-Received: via spool by 7722-submit@debbugs.gnu.org id=B7722.129608923518654 (code B ref 7722); Thu, 27 Jan 2011 00:48:02 +0000 Original-Received: (at 7722) by debbugs.gnu.org; 27 Jan 2011 00:47:15 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiG15-0004qp-2Z for submit@debbugs.gnu.org; Wed, 26 Jan 2011 19:47:15 -0500 Original-Received: from vm-emlprdomr-05.its.yale.edu ([130.132.50.146]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1PiG13-0004qU-Hd for 7722@debbugs.gnu.org; Wed, 26 Jan 2011 19:47:13 -0500 Original-Received: from furball (dhcp128036014126.central.yale.edu [128.36.14.126]) (authenticated bits=0) by vm-emlprdomr-05.its.yale.edu (8.14.4/8.14.4) with ESMTP id p0R0tJfb011410 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NOT); Wed, 26 Jan 2011 19:55:21 -0500 Original-Received: by furball (Postfix, from userid 1000) id 1F92C160023; Wed, 26 Jan 2011 19:55:16 -0500 (EST) In-Reply-To: <87hbd0y8sb.fsf@stupidchicken.com> (Chong Yidong's message of "Sat, 22 Jan 2011 15:37:24 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-Scanned-By: MIMEDefang 2.71 on 130.132.50.146 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Wed, 26 Jan 2011 19:48:02 -0500 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:43667 Archived-At: Chong Yidong 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.