From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74966: 31.0.50; Crash report (using igc on macOS) Date: Tue, 07 Jan 2025 13:03:15 +0000 Message-ID: <875xmqhj3k.fsf@protonmail.com> References: <87r062jpi1.fsf@protonmail.com> <874j2xhxp2.fsf@protonmail.com> <86jzbt6mh7.fsf@gnu.org> <86jzbgm16h.fsf@gnu.org> Reply-To: Pip Cet Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19206"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, spd@toadstyle.org, Eli Zaretskii , monnier@iro.umontreal.ca, 74966@debbugs.gnu.org To: Andrea Corallo Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Jan 07 14:04:21 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 1tV9Fs-0004pn-HB for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 07 Jan 2025 14:04:20 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tV9Fe-0006RL-8A; Tue, 07 Jan 2025 08:04:06 -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 1tV9Fc-0006Qq-Bt for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 08:04:04 -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 1tV9Fb-0006kt-NI for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 08:04:03 -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:References:In-Reply-To:From:Date:To:Subject; bh=/7y0vjKs/Iz3WdVl0FJUusf6PJsECjE5BLciX7NC1VM=; b=ItFEOibnmoCxJEc0ZM0m81hwHURgHXjiq4OYNqviHbcFT6DPu6PmFJ7aqmvpoO2tdsRss/dASJBdj5mylIS80JgGDn4g4b24c6IO98e3G1PE4f+7gl9E9eOmwpC6IQ/XRu4xxootGpCZ6KOu7MYL65SNvACbFjOXJjKEFbIr9RxjIO1tf5kCMnzrTiIBW3dhrFkNIvYVmIZXaIBg555l8V+XbjhDYP7XtfQ9bT3E4+BIpCO3CHA+xmk48dSwmorofH2IRJSTOZYwYd2JrNryH58WdSkM5CKpjQteDG8uHfOL8zBADCmLgvWOwiPH4t7jYgt8j0+1FB7okW5bv2xSJQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tV9Fa-0006GA-4y for bug-gnu-emacs@gnu.org; Tue, 07 Jan 2025 08:04:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 07 Jan 2025 13:04: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.173625501124015 (code B ref 74966); Tue, 07 Jan 2025 13:04:02 +0000 Original-Received: (at 74966) by debbugs.gnu.org; 7 Jan 2025 13:03:31 +0000 Original-Received: from localhost ([127.0.0.1]:42052 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tV9F4-0006FG-Os for submit@debbugs.gnu.org; Tue, 07 Jan 2025 08:03:31 -0500 Original-Received: from mail-4322.protonmail.ch ([185.70.43.22]:55373) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1tV9F2-0006F2-HW for 74966@debbugs.gnu.org; Tue, 07 Jan 2025 08:03:29 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1736255002; x=1736514202; bh=/7y0vjKs/Iz3WdVl0FJUusf6PJsECjE5BLciX7NC1VM=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector:List-Unsubscribe:List-Unsubscribe-Post; b=D7xMeZXZgIZGuACKVoisdbIkGt4GtE2lkGh0GAIlST30ysSTsw9dZ1yE43UWLaPAm 5Mj61HL1P84JteGr8nU8+dbdxJKaiu26liRG973E6xQ00InfEvWi/30WZJYj5Sgb6h ReABCNik9vqI3PVZG97zkAlMxQZP/fd3ZN3w+LPUGQ+JrV9L1Js9zmQYSoO7ncYMjU JvzrckgEy23RqvHwrUrhsN5fJSIjRAJ1hMG0Meq8ZiWGKrz5GI1MEfAbmSyR3k7x2l BCelONhqPTl4pNnrH2cm2yGLX0btYbCyquq2Afvh1+l8pJ5/+VOAxuFq7xKPiheNBi nXl7RA1sooxZw== In-Reply-To: Feedback-ID: 112775352:user:proton X-Pm-Message-ID: ef4a72793b5e4354c77ab50466566aa7475e300c 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:298719 Archived-At: "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 distinguis= h indices >>> >> > into the constant vector from indices into the DOC file. >>> >> >>> >> And use one's-complement, I assume, to guard against some future wei= rd >>> >> 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 chec= k >>> 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! > If someone is motivate to > jump on the task before me feel free. Here's a patch (IIRC, C doesn't require ~x =3D -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) =20 * 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, =09 build_string ("missing documentation vector")); - return AREF (cu->data_fdoc_v, XSUBR (function)->doc); + EMACS_INT doc =3D XSUBR (function)->doc; + if (doc < 0) + return AREF (cu->data_fdoc_v, -doc - 1); + return make_fixnum (doc); } =20 static Lisp_Object @@ -5529,7 +5532,8 @@ make_subr (Lisp_Object symbol_name, Lisp_Object minar= g, Lisp_Object maxarg, x->s.symbol_name =3D xstrdup (SSDATA (symbol_name)); x->s.intspec.native =3D intspec; x->s.command_modes =3D command_modes; - x->s.doc =3D XFIXNUM (doc_idx); + x->s.doc =3D -XFIXNUM (doc_idx) - 1; + eassert (x->s.doc < 0); #ifdef HAVE_NATIVE_COMP x->s.native_comp_u =3D comp_u; x->s.native_c_name =3D 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 o= ffset) fun =3D XCDR (fun); /* Lisp_Subrs have a slot for it. */ if (SUBRP (fun)) - XSUBR (fun)->doc =3D offset; + { + XSUBR (fun)->doc =3D offset; + eassert (XSUBR (fun)->doc >=3D 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;