Subject: bug#54501: Segfault on recursive structure

From: Andreas Schwab <[email-masked]>
Date: Tue, 22 Mar 2022 16:02:57 +0100

On Mär 22 2022, Lars Ingebrigtsen wrote:

> So this bug report is about two things.  The first is that this reads to
> (nil):
>
> #0=#0#
>
> Which seems odd.  Reading #0=#1# signals an error, but it's not
> immediately clear to me whether #0=#0# is totally nonsensical or not.
> And if not, is (nil) the right result?  Anybody?

That's an side effect of the implementation: (nil) is the placeholder
object which #0# then references.

> The other thing is more serious, and reading the following will segfault
> your Emacs, so don't do that:
>
> #0=[#1=(#0# . #1#)]
>
> Now, Emacs segfaults on trying to gc a number of recursive objects
> (especially ones that recurse in the `car'), but this seems to actually
> segfault in the reader.  Is it obvious to anybody why?

Does it crash in substitute_object_recurse?

-- 
Andreas Schwab, [email-masked]
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."