From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Po Lu via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#62009: 29.0.60; Emacs crashes on setf symbol-name Date: Sat, 11 Mar 2023 15:07:56 +0800 Message-ID: <87o7ozepf7.fsf@yahoo.com> References: <87o7p5of4n.fsf@daniel-mendler.de> <871qm01s6n.fsf@web.de> <9fcf05e8-506c-6566-e214-2ecf3194b85e@daniel-mendler.de> <83bkl45ul4.fsf@gnu.org> <87v8j9zl3i.fsf@posteo.net> <83a60l13p2.fsf@gnu.org> <16ecbe9ea8ba9d39d058@heytings.org> <16ecbe9ea85b22d008fd@heytings.org> <43460d2c-ba80-0f2f-656c-ef0aca5667b5@daniel-mendler.de> <87fsacx2qf.fsf@gmail.com> Reply-To: Po Lu Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11755"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: Philip Kaludercic , michael_heerdegen@web.de, Daniel Mendler , Gregory Heytings , monnier@iro.umontreal.ca, 62009@debbugs.gnu.org, Eli Zaretskii , Augusto Stoffel To: Robert Pluim Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Mar 11 08:09:13 2023 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 1patLs-0002oo-Vw for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 11 Mar 2023 08:09:13 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1patLp-0006z2-MQ; Sat, 11 Mar 2023 02:09:09 -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 1patLi-0006yl-Ie for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:09:03 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1patLi-0006Yl-7L for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:09:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1patLi-0003tY-2c for bug-gnu-emacs@gnu.org; Sat, 11 Mar 2023 02:09:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Po Lu Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 11 Mar 2023 07:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 62009 X-GNU-PR-Package: emacs Original-Received: via spool by 62009-submit@debbugs.gnu.org id=B62009.167851850114924 (code B ref 62009); Sat, 11 Mar 2023 07:09:02 +0000 Original-Received: (at 62009) by debbugs.gnu.org; 11 Mar 2023 07:08:21 +0000 Original-Received: from localhost ([127.0.0.1]:56443 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1patL3-0003se-E8 for submit@debbugs.gnu.org; Sat, 11 Mar 2023 02:08:21 -0500 Original-Received: from sonic305-20.consmr.mail.ne1.yahoo.com ([66.163.185.146]:42708) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1patKy-0003sO-He for 62009@debbugs.gnu.org; Sat, 11 Mar 2023 02:08:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1678518490; bh=yUR+jZYHnF0/GS1vVEbPqCcDKbd8cEeO5F7WrEYGO7k=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From:Subject:Reply-To; b=YrmdYZCipjNEiXqIAzMtjmvCxCEKHt8wRDyG01yj5bTc81Z5Wy856Fgvw/SPgIyux2L+nWrRwgc3Sn96GL1yLLzAonEcfMBAO6fkJnE/vMc3X4KmQTNXX6raa/NDNBJuv8uHfRo2putlMcg5f3A1szVkJ6dKfaKnIVdvRYq4ayU80KNKMiNGsUq/sE6AaPpDDecbySl9flWFddKi8ip+laNdFi/Fry8vd4RdL125v65UQnNmRdDSRgxW7h8fLBvp0udobX6WT40XWgSgJqM0BWxMJmYXef6qFyMOsGxnXAiy1BB4B5jEqM9etjBrD8u8zEDPcmCjx1jZLuCNH6f61w== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1678518490; bh=sGHaWTOk7zmlzDOky8v/b+snyRXmd5pgX1Iw80XRk/h=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=Su041tWyjml0chm1nHONi7Rc6MQPgquYvkbGglB2hbWUknPd41lcs2mpKBjaEkWpH7Voa280GiZeIl9dOiaV07MR2EuJM+Lqr8VDyhcQRuSEBaflYOp3FQoR8B86AMhViQ+YRTsIxNGLMxCVORfW0X03RnFWwmp/6dKnpNt8bDJ6+fRfMkfn2qva4z4GjqRYnOsuWTYDY01CBYgFWX2rHNLE2yuoBh5HB3Q0aR8lG+pjq5x003sAXAi4Y4MqIK6rUH3lcRSp3b6S3Bi6fg478sjbDPLiGshFT0q6JXcNjXIJz+iwJgBPkcp6vQe00qXnO5QXdxqKqajQIdUaoDUSmw== X-YMail-OSG: 4I.DDOcVM1lSSlablra210BtkaFf6oB1laxab2Ba1b7maqz3AbiXDXU83gXijOA HeES6yv9WDfi5z7x7J.i_ka85GTV5gFIXPK81ZjXa2IsKqM_ZbbG07b6Ax2IreNM40TSay9g0r9G MIP8_wH_pj8AX91izbj5JlhuWNhTEYAGH6Q7nO.uLl_8h.wuTac4te6zmDfH4m3xQK4GmMBFClMF caNBl5i_BGTRYrYZIZL7YLKDfh2WJfa74q.Ofqgu2cFPAqjnbf0JTPovAJTCkyKlDMAPzq2c5Sn5 4rh.4i6v2tmPHhHa9jdIv9K0Fegpuk.IlkyJ4Jal9gFrHHOvYE3FZtJ7j_rvfGs5GxYbqZwznoTO aRBEFdNSGIyWrbnf2_2HALJIObyn6O7lZcU8KJ6l6CkWaevXUMN3.dg4IBMLfhewrcD89s6ly1Od DM8mSyG.4mZ.X7qLqK1xXZbJw6mYrYsr2LZVWV8guqBVn.bunFfvWgs0HT0N7DD0xEhEm3k8_GEP NVYZsoJlA7_2Zx3_zzTC6JUejdame6WzBv7ZVl2Zc9v1iOfsOp0xDAaiaYuRGScQd0B6Vk_FmLPN G4zfwkg1ltpph7tDzw7_IHvy7cVi9fI_5x3r3pTQ3s1FdeMlnK6KyvY.BVZDiuNYmK9ssASQ.b.K ta.wdMxuFt25C4_5GJRn9c_jZZZNMTI_EKzsxKfhNyI4eRUAMkf7TPpNzZmczIijTo1bWr5.9Krs mfVKv6p4r4HbPveKLXGmlLLDZtOvhvupzBAcXi4Jz_CKExHuSXN0ReS9AxulqT3i0hD2vRTSMYXh hyYq8poA3pq05jm2Nh0TbHB_zhl4dMuCuOAVkBczrZ X-Sonic-MF: X-Sonic-ID: db89733b-308e-40f7-87e1-d61b019e9518 Original-Received: from sonic.gate.mail.ne1.yahoo.com by sonic305.consmr.mail.ne1.yahoo.com with HTTP; Sat, 11 Mar 2023 07:08:10 +0000 Original-Received: by hermes--production-sg3-67c57bccff-l44jm (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID 9103978f23340fb9c7045fb387aabe03; Sat, 11 Mar 2023 07:08:03 +0000 (UTC) In-Reply-To: <87fsacx2qf.fsf@gmail.com> (Robert Pluim's message of "Fri, 10 Mar 2023 12:30:48 +0100") X-Mailer: WebService/1.1.21284 mail.backend.jedi.jws.acl:role.jedi.acl.token.atz.jws.hermes.yahoo 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:257755 Archived-At: Robert Pluim writes: >>>>>> On Fri, 10 Mar 2023 12:09:59 +0100, Daniel Mendler said: > > Daniel> One could check if the string is located in read-only memory. Or one > Daniel> could add a flag bit to the string data structure (and possibly to other > Daniel> data structures too). Freezing data structures such that they become > Daniel> read-only is a generally useful feature. There won't be any performance > Daniel> overhead of the check since a branch not taken is fast thanks to the > Daniel> branch predictor. > > We already have such a flag: > > /* Number of characters in string; MSB is used as the mark bit. */ > ptrdiff_t size; > /* If nonnegative, number of bytes in the string (which is multibyte). > If negative, the string is unibyte: > -1 for data normally allocated > -2 for data in rodata (C string constants) > -3 for data that must be immovable (used for bytecode) */ > ptrdiff_t size_byte; > > Try this: > > diff --git a/src/lisp.h b/src/lisp.h > index 1276285e2f2..80bbb047824 100644 > --- a/src/lisp.h > +++ b/src/lisp.h > @@ -1685,6 +1685,8 @@ SREF (Lisp_Object string, ptrdiff_t index) > INLINE void > SSET (Lisp_Object string, ptrdiff_t index, unsigned char new) > { > + if (XSTRING (string)->u.s.size_byte == -2) > + Fsignal (Qsetting_constant, string); > SDATA (string)[index] = new; > } > INLINE ptrdiff_t > > Robert Why does this have to be in SSET and not in PURE_P?