Subject: bug#580: 23.0.60; OSX: Crash in show-paren-mode

From: Stefan Monnier <[email-masked]>
Date: Tue, 22 Jul 2008 14:54:37 -0400

> Let c6.el consist of the following form:

>    (while t
>      (insert "(when t (if t t 'hi))\n"))

> There must not be any blank lines at the start of the file; the file
> is also available from: http://www.logic.at/prolog/c6.el .

> When I do:

>    $ emacs -Q c6.el -f show-paren-mode

> and then repeatedly:

>    C-M-x C-g C-_

> Emacs crashes within a few iterations with the following backtrace:

I cannot reproduce it on my GNU/Linux machine with the latest CVS code.

> Program received signal EXC_BAD_ACCESS, Could not access memory.
> Reason: KERN_INVALID_ADDRESS at address: 0x02dc6fff
> 0x0016b0f5 in char_quoted (charpos=1, bytepos=48001023) at syntax.c:312
> 312       DEC_BOTH (charpos, bytepos);
> (gdb) bt
> #0  0x0016b0f5 in char_quoted (charpos=1, bytepos=48001023) at syntax.c:312
> #1  0x0017391d in back_comment (from=9, from_byte=9, stop=1, comnested=0, comstyle=0, charpos_ptr=0xbfffe468, bytepos_ptr=0xbfffe46c) at syntax.c:597

This is odd for 2 reasons:
1 - the bytepos=48001023 is clearly wrong.  Maybe it's a GDB error?
2 - the code of char_quoted (as of an hour ago) should not
    execute DEC_BOTH at all if charpos == 1.

Can you still reproduce the problem with the latest CVS code?  If so,
please try and figure out why DEC_BOTH is executed, and also try and
figure out if bytepos is really equal to 48001023 (it should be equal
to charpos) and if so, we need to track down its origin.

        Stefan