Subject: bug#76327: 29.4; random segfaults after switch to tree-sitter

From: Pip Cet <[email-masked]>
Date: Tue, 18 Feb 2025 15:12:41 +0000

"Eli Zaretskii" <[email-masked]> writes:

>> Date: Tue, 18 Feb 2025 12:55:12 +0300
>> From: Evgeniy Dushistov <[email-masked]>
>> Cc: [email-masked], Eli Zaretskii <[email-masked]>,
>> 	[email-masked]
>>
>>
>> On Mon, Feb 17, 2025 at 08:31:25PM +0000, Pip Cet wrote:
>> > Yes, it does trigger a lot.  You can restrict the breakpoint to trigger
>> > only when value is Qlistp by doing
>> >
>> > b wrong_type_argument if value == Qlistp
>> >
>>
>> I build with enable-checking=all and use b wrong_type_argument if value == Qlistp.
>>
>> lisp.h:1497: Emacs fatal error: assertion failed: CONSP (a)
>
> Is this session still inside GDB?  I guess not, which is a pity.
>
> The crash is here:
>
> 	if (CONSP (event->arg))
> 	  return list5 (head, position, make_fixnum (double_click_count),
> 			XCAR (event->arg), Fcons (XCAR (XCDR (event->arg)),
> 						  XCAR (XCDR (XCDR (event->arg)))));
>
> It's an assertion violation, which probably means XCAR(event->arg) is
> not a cons cell.  So it would be important to see the exact value of

XCAR (event->arg) probably isn't a cons cell, but XCDR (event->arg)
and XCDR (XCDR (event->arg)) should be.

The various crashes all look like there's some sort of fundamental GC
problem, leading us to free cons cells which are still reachable.

Can we find out precisely which compiler is in use?  Maybe it would even
help to get hold of the emacs binary...

> P.S. You could also try building the latest pretest of what will soon
> become Emacs 30.1, maybe this problem was already fixed.  You can find
> the pretest tarballs here:
>
>     https://alpha.gnu.org/gnu/emacs/pretest/

That's also a great idea.  My guess it's the unusual compile flags cause
some sort of miscompilation here.

Pip