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#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position Date: Thu, 19 Oct 2023 11:49:32 +0200 Message-ID: References: <871qdr15r9.fsf@epfl.ch> 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="23647"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Alan Mackenzie , 66628@debbugs.gnu.org, Stefan Monnier To: "Basil L. Contovounesios" Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 19 11:51:55 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 1qtPh4-0005qu-Rk for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 19 Oct 2023 11:51:54 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qtPgG-0002qf-2e; Thu, 19 Oct 2023 05:51: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 1qtPg2-0002bs-Rz for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 05:50:52 -0400 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 1qtPfn-0005K6-O8 for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 05:50:48 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qtPgE-0003YJ-6Z for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 05:51: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, 19 Oct 2023 09:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 66628 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 66628-submit@debbugs.gnu.org id=B66628.169770901013572 (code B ref 66628); Thu, 19 Oct 2023 09:51:02 +0000 Original-Received: (at 66628) by debbugs.gnu.org; 19 Oct 2023 09:50:10 +0000 Original-Received: from localhost ([127.0.0.1]:35868 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtPfO-0003Wq-8c for submit@debbugs.gnu.org; Thu, 19 Oct 2023 05:50:10 -0400 Original-Received: from mail-lf1-x12c.google.com ([2a00:1450:4864:20::12c]:42199) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtPfL-0003Vf-ER for 66628@debbugs.gnu.org; Thu, 19 Oct 2023 05:50:08 -0400 Original-Received: by mail-lf1-x12c.google.com with SMTP id 2adb3069b0e04-5079f9ec8d9so655803e87.0 for <66628@debbugs.gnu.org>; Thu, 19 Oct 2023 02:49:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1697708975; x=1698313775; darn=debbugs.gnu.org; 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=e8GxFzyxkV3i0r2YPLo+Oo+KMcP6UpNZCUTXyxYsePI=; b=Mixwy10jeYTjzpNm4g8m2xj6nFJZcPADVyT/jHeQKAGGvnfmIfbPpRGBElCMLa+cNR 3kYvTo+2dTBQU1s5gP9m565FECFG35CWs1eAVbbK5NV6CseQ3vwQhNei2nSlbny9EX1S 5Or8f1GGKdd3k0hwTzvWj/GMF8V5Z58KanoKrISqp61biBE6rYKBRmnoIUKUNCe9D+zT EMNm+WL+JOSiUbWwkxjrlzvApE+k8MC2S22Axgwi4UNEV0fQWP6JPwWGDdSWiklhubz5 OsjQZYIN4qIWUvuzcatY1WWIoyKZymEkpBDSZ3QbPCqgvkO3a/GJelQHPulZULwug/rg HYew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697708975; x=1698313775; 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=e8GxFzyxkV3i0r2YPLo+Oo+KMcP6UpNZCUTXyxYsePI=; b=gFbAy15N0BqlYSuxXCnttYKXJVZFeB6h07iwhjvllBXE5/dZgvdaCGBxl8Ni0m+CkR mmgescqomAtCansLJTyoyb9NxpNq8yupH7i4Y/5I43oNXpTYmbt7FoLSW8dL+SE4Qgyk triY6N3V+K/ymfo5hJXnlHjOxDJpNLGjDJEXqZ/DSHnF7qlvaD0yroRH/U+Sgmf00qee VQvfrjV8gbhW9W8642lKaudGkSsYVN3ZyFmdA4ThoX6XJO3EGfwPt5Tu0MSyn0Rt+cwn hiFnCS7NlFzbitRW4JK+MhguuTjUCdqzLAx/1mZrE2eKxHNyPIwyFH3QFRivNhXGVaJE NlfA== X-Gm-Message-State: AOJu0YzN/FYXzuvJ2bu7gj1vqz8p1wbm6KxtkpbynspZObYOllQV5GSI wtJVdk3og/J8sn/bXYk6Ofo= X-Google-Smtp-Source: AGHT+IFfeFm5FRN2XidVQ3f2A4vlJI82rlcwasu17WocrfOM1PJYABjjbUfrd46biJEJZHJMmdsvZg== X-Received: by 2002:a05:6512:1113:b0:502:e0dd:628b with SMTP id l19-20020a056512111300b00502e0dd628bmr428820lfg.32.1697708974560; Thu, 19 Oct 2023 02:49:34 -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 c13-20020a056512324d00b004fe333128c0sm1037041lfr.242.2023.10.19.02.49.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Oct 2023 02:49:33 -0700 (PDT) In-Reply-To: <871qdr15r9.fsf@epfl.ch> 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:272712 Archived-At: 19 okt. 2023 kl. 08.32 skrev Basil L. Contovounesios : > $ EMACS_GENERATE_DYNVARS=3D1 emacs -Q -batch -f batch-byte-compile = foo.el > Generating /tmp/foo.elc.dynvars >=20 > $ cat foo.elc.dynvars > (# . "/tmp/foo.el") > (# . "/tmp/foo.el") Oops, good that you found this. The patch looks fine. Thank you! We could actually contemplate enriching the .dynvars format with source = locations of the declarations when available, but it's perhaps just = gold-plating at this point. > Side question: if I replace >=20 > (let ((foo-y 1)) > (ignore foo-y) > (setq foo-y 2)) >=20 > with >=20 > (let ((foo-y 1)) > (ignore foo-y) > (bar-x foo-y)) >=20 > in bar.el (i.e. foo-y is only read, never set), the .dynvars warning > about foo-y disappears. I assume this is due to an earlier cconv / > constant propagation pass, is that right? Yes, constant propagation will substitute 1 for `foo-y` in the second = case during Lisp-level optimisation because absent any dynamic = declaration the variable is assumed to be lexical there. The warning is = only emitted in the backend (codegen) which is admittedly a bit late. > If so, I'm curious > whether/how the .dynvars feature could be adapted to cope, e.g. by > taking place at an earlier stage. Yes, it might be possible to move it to the frontend and in fact it's = generally preferable to check for warnings at that stage. You could try = doing that if you wish; I would like to make a frontend refactoring to = make this sort of thing easier -- right now the frontend is part of = cconv, except for the bit that's in macroexp-all.