From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Newsgroups: gmane.emacs.bugs Subject: bug#63564: 29.0.91; (setcdr) behaves differently between natively and byte compiled code Date: Thu, 18 May 2023 20:01:48 +0200 Message-ID: <8538FA15-8814-4CE3-AD33-16E7EEF19DC1@gmail.com> References: <83pm6yw2tu.fsf@gnu.org> <382e9fc0-c016-49a6-8341-e7bc2c90394c@Spark> Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="7884"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 63564@debbugs.gnu.org, Andrea Corallo To: Jimmy Wong Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu May 18 20:02:14 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 1pzhx8-0001wi-GM for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 18 May 2023 20:02:14 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pzhwy-0007nD-R6; Thu, 18 May 2023 14:02:04 -0400 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 1pzhww-0007mp-N4 for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 14:02:02 -0400 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 1pzhww-0005Gd-Cj for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 14:02:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pzhww-000255-7N for bug-gnu-emacs@gnu.org; Thu, 18 May 2023 14:02:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 18 May 2023 18:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 63564 X-GNU-PR-Package: emacs Original-Received: via spool by 63564-submit@debbugs.gnu.org id=B63564.16844329197990 (code B ref 63564); Thu, 18 May 2023 18:02:02 +0000 Original-Received: (at 63564) by debbugs.gnu.org; 18 May 2023 18:01:59 +0000 Original-Received: from localhost ([127.0.0.1]:54474 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzhwt-00024n-9e for submit@debbugs.gnu.org; Thu, 18 May 2023 14:01:59 -0400 Original-Received: from mail-lj1-f174.google.com ([209.85.208.174]:62946) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pzhwr-00024Y-2s for 63564@debbugs.gnu.org; Thu, 18 May 2023 14:01:57 -0400 Original-Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2af189d323fso10260271fa.1 for <63564@debbugs.gnu.org>; Thu, 18 May 2023 11:01:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684432911; x=1687024911; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=mmItgThDkK7Y0jD0VPH4OQgkYXpnC3QdYAlEjnR/UlE=; b=Psg6zl3+qmogb63GXhluAJiigtlFVri3qXgTJcnJqF9FwyLd6zhiwlFz/vZL+XCHDg pmymT0sLvi+fCBLUCd4fReIzN+Y2YqxHWuxnzoIUi2XT/d3tWXwkmg+NVluTvc/N5xdz /LbCZOxB+0V2S8pW8O8VKLX8YrNg4bQTcRUQj/CHXm3KhidDEg6E+1rY7jiMQYVoYmmV uuF1zdztx3/4G7AJsAH0GyiG5lL+nKynUa5BQ6Zatg42Yf9vKi0z4tSMkRlz84ZRYA49 0GcEdLb1mO0Bb2jtlMih21D2cKxjRMAAfi/ZAVAyAs0MQL0hW4ogh5pCUwvGVOwtZ7uh f6UQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684432911; x=1687024911; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=mmItgThDkK7Y0jD0VPH4OQgkYXpnC3QdYAlEjnR/UlE=; b=fA1rsbwUpFDd60DeDFQqgLEICgxjq5/25c2PNQx9uTIMa1r72hypeSRC30SQmY/0a1 l3ocmhKejWdMtx+ERNyK30TLUSSmHWG0sgZdw3K2tm3FRQuwl7V6GJVJ1aG0jJckgz12 upM71bhoHyle4lsFd0cR1Kxhkoeg/aIUMnJLnEkNdV1YsOChZp5UfndeW4BTPAc2E5AG qccpow5zrcKqMDOuw5rBdMCgkE5huHgzDgfGmAhdcCD1x7k9Z1E9x/LLkhayLXimMUM6 q3r23T7g0IMfIWZBcuUHn6jb3oh7tWSq6tvD1MRA+H2j9m/J99qAtvYBHf+zN+Q6BLeR TyhA== X-Gm-Message-State: AC+VfDxzTjonwL+y8ccdkJ4OPbBJ3cHy5vJtEFNrw4i7QtdXBKbm4tnN bdSlyoKJGPKengn6KMSsmIw= X-Google-Smtp-Source: ACHHUZ58zHIlF7GOAFmF2qNhqeKK4e0UBlQRV7DiR4TCUX5Lz1OsAK/bBzRaBd5mZgiObp5bBsU6IA== X-Received: by 2002:a05:6512:3e27:b0:4f2:47ea:2f32 with SMTP id i39-20020a0565123e2700b004f247ea2f32mr2721lfv.23.1684432910675; Thu, 18 May 2023 11:01:50 -0700 (PDT) Original-Received: from smtpclient.apple (c188-150-165-235.bredband.tele2.se. [188.150.165.235]) by smtp.gmail.com with ESMTPSA id w2-20020a2e8202000000b002adc6c2cb3bsm414452ljg.5.2023.05.18.11.01.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 18 May 2023 11:01:50 -0700 (PDT) In-Reply-To: <382e9fc0-c016-49a6-8341-e7bc2c90394c@Spark> X-Mailer: Apple Mail (2.3654.120.0.1.15) 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:261950 Archived-At: 18 maj 2023 kl. 19.45 skrev Jimmy Wong : > As Mattias has noted, this commit on markdown-mode did fix the issues, = it would still be nice to know why the natively compiled version behaves = differently from the byte compiled version tho. This could be good = learning for occasional elisp devs such as myself to know what to watch = out for. The code was mutating a program constant (quoted list) which is a no-no = in Elisp. As luck has it, a new warning in Emacs 30 discovered it and a = markdown-mode maintainer changed the code accordingly (the commit = message says that he 'fixed a warning' but he really fixed broken code; = the warning is fine). Technically, the error likely occurred because the native compiler = propagated that constant to its points of use where it underwent some = compile-time evaluation. Essentially: (let ((root '(nil))) ... (let ((sibling-alist (last (cdr root)))) ; sibling-alist =3D nil (dotimes (_ (1- level)) (setq sibling-alist (last (cdar sibling-alist)))) ; still nil (setcdr sibling-alist alist) ; boom In Emacs 30 the byte-compiler is able to do some of that propagation as = well, and rightly so. Don't mutate program constants. It's not safe, and it has never been = safe.