Subject: Re: bug#74966: 31.0.50; Crash report (using igc on macOS)

From: Andrea Corallo <[email-masked]>
Date: Tue, 31 Dec 2024 05:22:11 -0500

Eli Zaretskii <[email-masked]> writes:

>> Date: Sat, 21 Dec 2024 15:18:43 +0000
>> From: Pip Cet <[email-masked]>
>> Cc: Gerd Möllmann <[email-masked]>, Eli Zaretskii <[email-masked]>, [email-masked], [email-masked], [email-masked]
>> 
>> "Stefan Monnier" <[email-masked]> writes:
>> 
>> >>> `offset` here should be fixnum that gives the position of this docstring
>> >>> in the DOC file.  And FUN should be a function for which we found
>> >>
>> >> Yes, but the nativecomp code assumes ->doc is an index into a
>> >> nativecomp'd subr's constant vector.
>> >
>> > Aha!
>> >
>> >> So we overwrite it with a docfile
>> >> index, access an out-of-bounds index and crash.
>> >>
>> >> I think the best thing to do is to use separate fields for the "offset"
>> >> doc and the "index" doc; or at least, the second best thing, after
>> >> removing the entire docfile hack.
>> >
>> > I think a much simpler change is to use the sign bit to distinguish indices
>> > into the constant vector from indices into the DOC file.
>> 
>> And use one's-complement, I assume, to guard against some future weird
>> nativecomp change resulting in the index -0?  :-)
>> 
>> I really have no strong preference here.
>
> And I still want to hear from Andrea.  It's his code, so the solution
> he prefers gets my vote.

Sorry for behing late here.

I'm for the sign bit, it saves memory (why not), and we can sanity check
that when the bit is set the function is a non-primitve one and vice
versa.

  Andrea