GNU bug report logs - #55771
29.0.50; cc-mode based uninterruptible infloop

Previous Next

Package: cc-mode;

Reported by: Michael Welsh Duggan <md5i <at> md5i.com>

Date: Thu, 2 Jun 2022 18:27:01 UTC

Severity: normal

Done: Alan Mackenzie <acm <at> muc.de>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Alan Mackenzie <acm <at> muc.de>
To: Michael Welsh Duggan <mwd <at> md5i.com>
Cc: acm <at> muc.de, 55771 <at> debbugs.gnu.org
Subject: bug#55771: [Michael Welsh Duggan] bug#55771: 29.0.50; cc-mode based uninterruptible infloop
Date: Tue, 7 Jun 2022 20:45:02 +0000
Hello, Michael.

On Mon, Jun 06, 2022 at 23:41:05 -0400, Michael Welsh Duggan wrote:
> I just wanted to poke you on this one, as I'm not certain it entered
> your notice due to the shoddy way I submitted it.

Apologies.  I missed it.

[ .... ]

> -------------------- Start of forwarded message --------------------
> Subject: bug#55771: 29.0.50; cc-mode based uninterruptible infloop
> To: 55771 <at> debbugs.gnu.org
> From: Michael Welsh Duggan <md5i <at> md5i.com>
> Date: Thu, 02 Jun 2022 14:26:08 -0400


> Create a directory containing the following two files:

> .dir-locals.el



> bug.el

> #ifndef IPFIX_FLOATPOINT_HPP
> #define IPFIX_FLOATPOINT_HPP
> 
> IPFIX__NEW_NAMESPACE
> 
> #endif  // IPFIX_FLOATPOINT_HPP


> >From that directory, run "emacs -Q bug.hpp".

> The result is an inflooping emacs from which `C-g' and `ESC ESC ESC'
> seem to do nothing useful.

> I stopped it in the debugger and ran `fin' several times, interspersing
> with `xbacktrace' calls until `fin` did not return.  The result is
> copied herein:

[ .... ]

Thanks, that backtrace was extraordinarily helpful.  It was one of these
places where I'd neglected to test the return code of c-forward-token-2.
As a result, point stayed in the same place in a loop which thus became
an infinite loop.

Can I ask you, please, to try out the following patch, and let me know
if it fixes the bug in your real C++ code.

I don't want to commit this yet, since I haven't yet checked CC Mode for
the same bug somewhere else (and it's getting late, here).  I may not
have much time to look at this in the next few days.



diff -r 6057991425e3 cc-engine.el
--- a/cc-engine.el	Tue May 24 16:11:52 2022 +0000
+++ b/cc-engine.el	Tue Jun 07 20:33:41 2022 +0000
@@ -8312,9 +8312,10 @@
 (defun c-forward-noise-clause ()
   ;; Point is at a c-noise-macro-with-parens-names macro identifier.  Go
   ;; forward over this name, any parenthesis expression which follows it, and
-  ;; any syntactic WS, ending up at the next token.  If there is an unbalanced
-  ;; paren expression, leave point at it.  Always Return t.
-  (c-forward-token-2)
+  ;; any syntactic WS, ending up at the next token or EOB.  If there is an
+  ;; unbalanced paren expression, leave point at it.  Always Return t.
+  (or (zerop (c-forward-token-2))
+      (goto-char (point-max)))
   (if (and (eq (char-after) ?\()
 	   (c-go-list-forward))
       (c-forward-syntactic-ws))



> In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.16.0)
>  of 2022-06-02 built on miko
> Repository revision: 8f279c8666dc642ed1f8f49aa709530fcea47374
> Repository branch: master
> Windowing system distributor 'The X.Org Foundation', version 11.0.12004000
> System Description: Debian GNU/Linux bookworm/sid

> Configured using:
>  'configure --without-toolkit-scroll-bars --with-x-toolkit=lucid
>  --with-native-compilation --with-xinput2 'CFLAGS=-Og -ggdb''

[ .... ]

> -- 
> Michael Welsh Duggan
> (md5i <at> md5i.com)

-- 
Alan Mackenzie (Nuremberg, Germany).




This bug report was last modified 3 years and 58 days ago.

Previous Next


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