GNU bug report logs -
#36484
c-mode hangs on macro with comment
Previous Next
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 36484 in the body.
You can then email your comments to 36484 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#36484
; Package
emacs
.
(Wed, 03 Jul 2019 00:38:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Nicholas Drozd <nicholasdrozd <at> gmail.com>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Wed, 03 Jul 2019 00:38:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Here's a simple C program:
#define x /***/5
int main(void) {
return x;
}
`gcc -Wall` compiles it without any warnings, but opening it causes
Emacs to hang, and sometimes even to freeze hard.
It has something to do with the macro, but I haven't been able to
figure out exactly what's going on.
Here's a test function with an even smaller reproducing example:
(defun c-mode-hang ()
(interactive)
(with-temp-buffer
(insert "#define /***/5")
(c-mode)))
Running that function under the profiler suggests that the problem is
in `c-end-of-macro`:
- c-extend-region-for-CPP 13869 98%
- c-end-of-macro 10470 74%
c-forward-single-comment 2759 19%
This may have something to do with commit 39acaf, or maybe 6b5388.
GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
of 2019-06-30
Information forwarded
to
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#36484
; Package
emacs,cc-mode
.
(Thu, 04 Jul 2019 10:37:01 GMT)
Full text and
rfc822 format available.
Message #8 received at 36484 <at> debbugs.gnu.org (full text, mbox):
Hello, Nicholas.
In article <mailman.43.1562114299.2688.bug-gnu-emacs <at> gnu.org> you wrote:
> Here's a simple C program:
> #define x /***/5
> int main(void) {
> return x;
> }
> `gcc -Wall` compiles it without any warnings, but opening it causes
> Emacs to hang, and sometimes even to freeze hard.
I can reproduce this, and I'm looking into the cause.
> It has something to do with the macro, but I haven't been able to
> figure out exactly what's going on.
> Here's a test function with an even smaller reproducing example:
> (defun c-mode-hang ()
> (interactive)
> (with-temp-buffer
> (insert "#define /***/5")
> (c-mode)))
> Running that function under the profiler suggests that the problem is
> in `c-end-of-macro`:
> - c-extend-region-for-CPP 13869 98%
> - c-end-of-macro 10470 74%
> c-forward-single-comment 2759 19%
Thanks, that's helpful information.
> This may have something to do with commit 39acaf, or maybe 6b5388.
> GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
> of 2019-06-30
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#36484
; Package
emacs,cc-mode
.
(Thu, 04 Jul 2019 13:35:03 GMT)
Full text and
rfc822 format available.
Message #11 received at 36484 <at> debbugs.gnu.org (full text, mbox):
Hello again, Nicholas.
In article <mailman.43.1562114299.2688.bug-gnu-emacs <at> gnu.org> you wrote:
> Here's a simple C program:
> #define x /***/5
> int main(void) {
> return x;
> }
> `gcc -Wall` compiles it without any warnings, but opening it causes
> Emacs to hang, and sometimes even to freeze hard.
> It has something to do with the macro, but I haven't been able to
> figure out exactly what's going on.
There was an infinite loop in c-end-of-macro, now fixed.
[ .... ]
> Running that function under the profiler suggests that the problem is
> in `c-end-of-macro`:
Indeed, so.
[ .... ]
I've committed a patch to the Emacs repository master branch. Would you
please update your copy of master, and confirm the bug is indeed fixed
(or else, tell me what's still wrong).
> GNU Emacs 27.0.50 (build 6, x86_64-pc-linux-gnu, GTK+ Version 3.22.30)
> of 2019-06-30
Thanks for taking the trouble to report this bug, and thanks even more
for making it such an easy to follow report, and doing so much diagnosis
on it.
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#36484
; Package
emacs,cc-mode
.
(Thu, 04 Jul 2019 17:09:01 GMT)
Full text and
rfc822 format available.
Message #14 received at 36484 <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Works for me! Attached is a patch for an added cc-mode test case.
By the way, I came across this issue because a similar line appears in
a winning entry to the 1988 International Obfuscated C Code Contest
(https://www.ioccc.org/1988/dale.c). That line is included in the test
case.
Trivia question: which Emacs maintainer is a past IOCCC winner?
[0001-test-lisp-progmodes-cc-mode-tests.el-Add-test-for-bu.patch (text/x-patch, attachment)]
bug Marked as fixed in versions 27.1.
Request was from
Noam Postavsky <npostavs <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Mon, 15 Jul 2019 20:45:02 GMT)
Full text and
rfc822 format available.
Reply sent
to
Alan Mackenzie <acm <at> muc.de>
:
You have taken responsibility.
(Wed, 17 Jul 2019 08:23:01 GMT)
Full text and
rfc822 format available.
Notification sent
to
Nicholas Drozd <nicholasdrozd <at> gmail.com>
:
bug acknowledged by developer.
(Wed, 17 Jul 2019 08:23:01 GMT)
Full text and
rfc822 format available.
Message #21 received at 36484-done <at> debbugs.gnu.org (full text, mbox):
Hello, Nicholas.
On Thu, Jul 04, 2019 at 12:08:14 -0500, Nicholas Drozd wrote:
> Works for me!
That's great, thanks. I'm closing the bug with this post.
> Attached is a patch for an added cc-mode test case.
The patch works fine, too, thanks. But I got bogged down on the
copyright assignment sort of things for the patch.
Have you signed copyright assignment papers for Emacs? (I think you
have, judging by the number of commits in your name, but I don't know
where to look to check.)
Otherwise, it would appear that your patch is a "trivial" patch, in that
it is less than 15 lines long. But I think that only applies when the
total number of lines you've contributed to Emacs is less than about 15.
So, sorry about all this non-creative stuff, but would you please tell
me whether or not you've signed an Emacs copyright assignment. Then I
should be able to commit your patch.
> By the way, I came across this issue because a similar line appears in
> a winning entry to the 1988 International Obfuscated C Code Contest
> (https://www.ioccc.org/1988/dale.c). That line is included in the test
> case.
> Trivia question: which Emacs maintainer is a past IOCCC winner?
I don't know (and haven't cheated by researching it ;-), but if I had to
guess, I'd say Paul Eggert.
[ snip patch ].
--
Alan Mackenzie (Nuremberg, Germany).
Information forwarded
to
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#36484
; Package
emacs,cc-mode
.
(Wed, 17 Jul 2019 13:31:01 GMT)
Full text and
rfc822 format available.
Message #24 received at 36484-done <at> debbugs.gnu.org (full text, mbox):
Yes, I've signed, and yes, it was him (1990)!
Information forwarded
to
bug-gnu-emacs <at> gnu.org, bug-cc-mode <at> gnu.org
:
bug#36484
; Package
emacs,cc-mode
.
(Wed, 17 Jul 2019 14:33:02 GMT)
Full text and
rfc822 format available.
Message #27 received at 36484 <at> debbugs.gnu.org (full text, mbox):
Hello again, Nicholas.
On Wed, Jul 17, 2019 at 08:29:44 -0500, Nicholas Drozd wrote:
> Yes, I've signed, ....
Great! I've committed the amendment to cc-mode-tests.el in your name.
> .... and yes, it was him (1990)!
Hah! Good guess then! It doesn't surprise me at all.
--
Alan Mackenzie (Nuremberg, Germany).
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Thu, 15 Aug 2019 11:24:07 GMT)
Full text and
rfc822 format available.
This bug report was last modified 4 years and 254 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.