From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Andrea Corallo Newsgroups: gmane.emacs.bugs Subject: bug#74966: 31.0.50; Crash report (using igc on macOS) Date: Wed, 08 Jan 2025 05:33:09 -0500 Message-ID: References: <87r062jpi1.fsf@protonmail.com> <874j2xhxp2.fsf@protonmail.com> <86jzbt6mh7.fsf@gnu.org> <86jzbgm16h.fsf@gnu.org> <875xmqhj3k.fsf@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16946"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: gerd.moellmann@gmail.com, spd@toadstyle.org, Eli Zaretskii , monnier@iro.umontreal.ca, 74966@debbugs.gnu.org To: Pip Cet Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Jan 08 11:34:17 2025 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tVTOC-0004Eh-Al for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 08 Jan 2025 11:34:16 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tVTO0-0007c7-FY; Wed, 08 Jan 2025 05:34:04 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVTNz-0007bz-4L for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2025 05:34:03 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tVTNy-0002Ks-LN for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2025 05:34:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=SaGYYO9GydBklk7A4w+FhOqcdKMwBSMRFBKNcLjPiZ4=; b=VQ7cr/X06K6iDD/2j5y7olMltR7eEHj55I58iAxPC9vxRvW7VtGZ+eTlIdSiLbg52YcYUZaoI7URi2ay0Vdb7nyWUYjLUPIJ6/w8RqMBaGd2TvY/BebRJG56zRd2CGkboU7m682HS8xQfizfxCxRxODN8gnDCnV37JVoHwKrH41D42p1W75IMiR3DW1H4+GZNYhQ2Tua7WXo0m9/jZnxRE6XFeM9oJE1P9LynbgIUaMZ0vnt5qP+zdkM6bFQ5EYO9kOzWJRQ293aMFayUZxwBLB0HXVh8FZrhuWMqmrOtKfcpGRD2+t5MhSPhA+TR2BAbfQUzPzspL6gNBqqqIlvLQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tVTNy-0003IN-GL for bug-gnu-emacs@gnu.org; Wed, 08 Jan 2025 05:34:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Andrea Corallo Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 08 Jan 2025 10:34:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74966 X-GNU-PR-Package: emacs Original-Received: via spool by 74966-submit@debbugs.gnu.org id=B74966.173633239912603 (code B ref 74966); Wed, 08 Jan 2025 10:34:02 +0000 Original-Received: (at 74966) by debbugs.gnu.org; 8 Jan 2025 10:33:19 +0000 Original-Received: from localhost ([127.0.0.1]:46086 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tVTNG-0003HD-Ow for submit@debbugs.gnu.org; Wed, 08 Jan 2025 05:33:19 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40620) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tVTNE-0003H0-MW for 74966@debbugs.gnu.org; Wed, 08 Jan 2025 05:33:17 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tVTN8-0002Hy-LN; Wed, 08 Jan 2025 05:33:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To: From; bh=SaGYYO9GydBklk7A4w+FhOqcdKMwBSMRFBKNcLjPiZ4=; b=Gt/ICmZWYELVu/mLRvJn piRgoaQEb9qSf1YJavapE9PiM7aKqgG83Ik+fCoSw4pyT3O/w9paq/CTjYyUhgmnIeBrkTgLSIHg0 v6kNhijCqGSqtwOIOrqQaphLHVKGonloX2kE+rDH/WqijXDHMieva68wyp1HCHoSY41HsY8Ozhe79 PXBhVSs/gngQDOhf73W+pPz2Fd+kFEcviAaPumON+rp8xzy6EoPfJF83XYd0GWO8AB/MuYdXWLt0c c4/FeQjx0VZJQYlC0Wd+cs/4XZ/I2DCz/Z6GtAhIKLDbQ4VDEElXP8Kq0M5ObLvZbd5X1jkD/JXyT QQLC+Q1/x7d3vw==; Original-Received: from acorallo by fencepost.gnu.org with local (Exim 4.90_1) (envelope-from ) id 1tVTN7-0002Mp-DN; Wed, 08 Jan 2025 05:33:09 -0500 In-Reply-To: <875xmqhj3k.fsf@protonmail.com> (Pip Cet's message of "Tue, 07 Jan 2025 13:03:15 +0000") X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:298767 Archived-At: Pip Cet writes: > "Andrea Corallo" writes: > >> Eli Zaretskii writes: >> >>>> From: Andrea Corallo >>>> Cc: Pip Cet , monnier@iro.umontreal.ca, >>>> gerd.moellmann@gmail.com, spd@toadstyle.org, 74966@debbugs.gnu.org >>>> Date: Tue, 31 Dec 2024 05:22:11 -0500 >>>> >>>> Eli Zaretskii writes: >>>> >>>> >> > 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. >>> >>> OK, can you post a patch (or even install it)? >> >> Will do. I'll just need some time, I'm catching up with mails after >> holidays while being sick at the same time. > > Sorry to hear it. Get well soon! Thanks >> If someone is motivate to >> jump on the task before me feel free. > > Here's a patch (IIRC, C doesn't require ~x = -x - 1, so I used > the more explicit notation to avoid compiler warnings). > > commit 9654100f0ecc312b14ba56bf2e13691168342cf9 (HEAD -> signbit) > Author: Pip Cet > Date: Tue Jan 7 12:52:16 2025 +0000 > > Fix store_function_docstring for native subrs (Bug#74966) > > * src/comp.c (native_function_doc): > (make_subr): Use one's complement of doc index. > * src/doc.c (store_function_docstring): Add assertion. > * src/lisp.h (struct Lisp_Subr): Document 'doc' sign bit. > > diff --git a/src/comp.c b/src/comp.c > index 70a9a64a714..b96fae4ae95 100644 > --- a/src/comp.c > +++ b/src/comp.c > @@ -5488,7 +5488,10 @@ native_function_doc (Lisp_Object function) > if (!VECTORP (cu->data_fdoc_v)) > xsignal2 (Qnative_lisp_file_inconsistent, cu->file, > build_string ("missing documentation vector")); > - return AREF (cu->data_fdoc_v, XSUBR (function)->doc); > + EMACS_INT doc = XSUBR (function)->doc; > + if (doc < 0) > + return AREF (cu->data_fdoc_v, -doc - 1); > + return make_fixnum (doc); > } > > static Lisp_Object > @@ -5529,7 +5532,8 @@ make_subr (Lisp_Object symbol_name, Lisp_Object minarg, Lisp_Object maxarg, > x->s.symbol_name = xstrdup (SSDATA (symbol_name)); > x->s.intspec.native = intspec; > x->s.command_modes = command_modes; > - x->s.doc = XFIXNUM (doc_idx); > + x->s.doc = -XFIXNUM (doc_idx) - 1; > + eassert (x->s.doc < 0); > #ifdef HAVE_NATIVE_COMP > x->s.native_comp_u = comp_u; > x->s.native_c_name = xstrdup (SSDATA (c_name)); > diff --git a/src/doc.c b/src/doc.c > index 88be9121dab..04afe50d3dd 100644 > --- a/src/doc.c > +++ b/src/doc.c > @@ -479,7 +479,10 @@ store_function_docstring (Lisp_Object obj, EMACS_INT offset) > fun = XCDR (fun); > /* Lisp_Subrs have a slot for it. */ > if (SUBRP (fun)) > - XSUBR (fun)->doc = offset; > + { > + XSUBR (fun)->doc = offset; > + eassert (XSUBR (fun)->doc >= 0); > + } > else if (CLOSUREP (fun)) > { > /* This bytecode object must have a slot for the docstring, since > diff --git a/src/lisp.h b/src/lisp.h > index 339ff5e83b0..0979fedd846 100644 > --- a/src/lisp.h > +++ b/src/lisp.h > @@ -2228,6 +2228,9 @@ CHAR_TABLE_SET (Lisp_Object ct, int idx, Lisp_Object val) > Lisp_Object native; > } intspec; > Lisp_Object command_modes; > + /* positive values: offset into etc/DOC. Negative values: one's > + complement of index into the native comp unit's constant > + vector. */ > EMACS_INT doc; > #ifdef HAVE_NATIVE_COMP > Lisp_Object native_comp_u; LGTM thanks