From unknown Tue Aug 19 10:02:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position Resent-From: "Basil L. Contovounesios" Original-Sender: "Debbugs-submit" Resent-CC: acm@muc.de, mattias.engdegard@gmail.com, bug-gnu-emacs@gnu.org Resent-Date: Thu, 19 Oct 2023 06:34:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 66628 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 66628@debbugs.gnu.org Cc: "Alan Mackenzie" , "Mattias =?UTF-8?Q?Engdeg=C3=A5rd?=" X-Debbugs-Original-To: bug-gnu-emacs@gnu.org X-Debbugs-Original-Xcc: "Alan Mackenzie" , "Mattias =?UTF-8?Q?Engdeg=C3=A5rd?=" Received: via spool by submit@debbugs.gnu.org id=B.16976972248585 (code B ref -1); Thu, 19 Oct 2023 06:34:03 +0000 Received: (at submit) by debbugs.gnu.org; 19 Oct 2023 06:33:44 +0000 Received: from localhost ([127.0.0.1]:35585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtMbH-0002EO-F4 for submit@debbugs.gnu.org; Thu, 19 Oct 2023 02:33:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:37498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtMbE-0002E9-I9 for submit@debbugs.gnu.org; Thu, 19 Oct 2023 02:33:41 -0400 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 1qtMah-0003Kb-UT for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 02:33:08 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtMad-00013e-WB for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 02:33:07 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40839807e82so2225245e9.0 for ; Wed, 18 Oct 2023 23:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; t=1697697180; x=1698301980; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=d3aN8yhMwtcEGzg6kjhBMDABXsTWjt42hbcFnIPCn+M=; b=PEW79+A3jQy9+rmiAZuJGPWwZXccmhPnb1sFR24RP3+M6VQB6L+/LPQWmPn6DOSJvN LesX/3IEz912ITTxOm8jLqq6+d5BK5uCqUfkNNXTTbE3x1p3Cxl5IisV5Qg4SrS1KNhe ltQXmoNo1BOG1KYSTS/yb8G3Y5EMVn0b7ZTugWKvGs0Rnte2fk1l4sSz28pywX/w1kMO pnhyAkRnar1XiSN9eRGRfxUczcsNbP3aVTSTvlMf6CjPmpGrVWnbe1fpYtIlsrY42Z6l kIfSbbvFtdzfrYiiiHii3SqyvkZJI4tpFM9Zi5HDUm1bBeQ6hsSYhH5ROPp/feaDVWjN 72pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697697180; x=1698301980; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d3aN8yhMwtcEGzg6kjhBMDABXsTWjt42hbcFnIPCn+M=; b=um9incXCEwrdRs9Uv49Z3gRt1lIrXVomcCZMHqt/7S5bFkHRKcljYURlT9YcrNofwY E9WJKshbYVhBOwWdGorGzRgam/kDc4TB0CphbreAqAD2Jk8VfmpJevbrGPeQ/LN5DmZw 4wqMeNplhGQPJzuNhp+7PFjb5urirLR1Savx21HWOk3Ce0o0Won4WrSRSJdeXnnluUbD Zvk6Q7q3qn30t1+YPo48Or1MS2HwFyoXvj+ZCUtv1DdDiH6irQL9AKxCZ/sZ/g4OdSih 8uxU3lRR47iXbM10HtdMkFTW+FRoPExRiGF89mMR4221a/toTboI+fPw3ep14wyoB64x JBiQ== X-Gm-Message-State: AOJu0YwDLD+c5O6iHyef8ZklpRZcN0QDmaQKFYxG9cxzvXjetSVE0h4x rR9U5+7yxGnyg6LDyQ267wTmX2jj/+KPNbA7rxk= X-Google-Smtp-Source: AGHT+IGlwTnQUXJTEQOVxgv5935B/4pUsmHovpKi9m1xdA4nNA3FVf3x/FCG6WJ/yVII+GTZRBhjkQ== X-Received: by 2002:a05:600c:2a15:b0:400:5962:6aa9 with SMTP id w21-20020a05600c2a1500b0040059626aa9mr847862wme.11.1697697180325; Wed, 18 Oct 2023 23:33:00 -0700 (PDT) Received: from localhost ([2a02:aa12:b102:1b80:415e:345d:c031:c2fa]) by smtp.gmail.com with ESMTPSA id j22-20020a05600c1c1600b00405718cbeadsm1911604wms.1.2023.10.18.23.32.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 23:32:59 -0700 (PDT) From: "Basil L. Contovounesios" Date: Thu, 19 Oct 2023 08:32:58 +0200 Message-ID: <871qdr15r9.fsf@epfl.ch> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=contovob@tcd.ie; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Severity: minor Tags: patch Given the following two files under /tmp: ;;; foo.el -*- lexical-binding: t -*- (defvar foo-x) (defvar foo-y) ;;; foo.el ends here ;;; bar.el -*- lexical-binding: t -*- (defun bar-x (foo-x) (ignore foo-x)) (let ((foo-y 1)) (ignore foo-y) (setq foo-y 2)) ;;; bar.el ends here $ EMACS_GENERATE_DYNVARS=1 emacs -Q -batch -f batch-byte-compile foo.el Generating /tmp/foo.elc.dynvars $ cat foo.elc.dynvars (# . "/tmp/foo.el") (# . "/tmp/foo.el") $ EMACS_DYNVARS_FILE=foo.elc.dynvars emacs -Q -batch -f batch-byte-compile bar.el Since the .dynvars file makes for some bad reading, the last step gives no diagnostic, though I would expect it to. Here's a patch that binds print-symbols-bare appropriately: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Print-bare-symbols-for-EMACS_GENERATE_DYNVARS.patch >From 492ad0f4a97ca43409eb0fefacdfe84b0775cf15 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Wed, 18 Oct 2023 15:33:51 +0200 Subject: [PATCH] Print bare symbols for EMACS_GENERATE_DYNVARS * lisp/emacs-lisp/bytecomp.el (byte-compile--load-dynvars): Remove redundant goto-char. (byte-compile-file): Bind print-symbols-bare around .dynvars file generation. --- lisp/emacs-lisp/bytecomp.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 92abe6b4624..9d97678379c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2069,7 +2069,6 @@ byte-compile--load-dynvars (and file (not (equal file "")) (with-temp-buffer (insert-file-contents file) - (goto-char (point-min)) (let ((vars nil) var) (while (ignore-errors (setq var (read (current-buffer)))) @@ -2284,7 +2283,8 @@ byte-compile-file (let ((gen-dynvars (getenv "EMACS_GENERATE_DYNVARS"))) (when (and gen-dynvars (not (equal gen-dynvars "")) byte-compile--seen-defvars) - (let ((dynvar-file (concat target-file ".dynvars"))) + (let ((dynvar-file (concat target-file ".dynvars")) + (print-symbols-bare t)) (message "Generating %s" dynvar-file) (with-temp-buffer (dolist (var (delete-dups byte-compile--seen-defvars)) -- 2.42.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Now I get the following, as expected: $ EMACS_GENERATE_DYNVARS=3D1 emacs -Q -batch -f batch-byte-compile foo.el Generating /tmp/foo.elc.dynvars $ cat foo.elc.dynvars (foo-y . "/tmp/foo.el") (foo-x . "/tmp/foo.el") $ EMACS_DYNVARS_FILE=3Dfoo.elc.dynvars emacs -Q -batch -f batch-byte-comp= ile bar.el In bar-x: bar.el:2:2: Warning: =E2=80=98foo-x=E2=80=99 lexically bound in lambda he= re but declared dynamic in: /tmp/foo.el bar.el:3:8: Warning: =E2=80=98foo-y=E2=80=99 lexically bound in let here = but declared dynamic in: /tmp/foo.el WDYT? Side question: if I replace (let ((foo-y 1)) (ignore foo-y) (setq foo-y 2)) with (let ((foo-y 1)) (ignore foo-y) (bar-x foo-y)) 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? If so, I'm curious whether/how the .dynvars feature could be adapted to cope, e.g. by taking place at an earlier stage. Thanks, --=20 Basil In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2023-10-18 built on tia Repository revision: 06fc5c24170b820939d3d51071b2957354edcb65 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure 'CFLAGS=3D-O2 -ggdb3' -C --prefix=3D/home/blc/.local --enable-checking=3Dstructs --with-file-notification=3Dyes --with-x-toolkit=3Dlucid --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_IE.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 38082 9280) (symbols 48 5209 0) (strings 32 14036 1774) (string-bytes 1 387105) (vectors 16 10299) (vector-slots 8 156340 16868) (floats 8 23 23) (intervals 56 259 0) (buffers 992 10)) --=-=-=-- From unknown Tue Aug 19 10:02:57 2025 X-Loop: help-debbugs@gnu.org Subject: bug#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position 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 To: "Basil L. Contovounesios" Cc: Alan Mackenzie , 66628@debbugs.gnu.org, Stefan Monnier Received: via spool by 66628-submit@debbugs.gnu.org id=B66628.169770901013572 (code B ref 66628); Thu, 19 Oct 2023 09:51:02 +0000 Received: (at 66628) by debbugs.gnu.org; 19 Oct 2023 09:50:10 +0000 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 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 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) 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) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.15\)) From: Mattias =?UTF-8?Q?Engdeg=C3=A5rd?= In-Reply-To: <871qdr15r9.fsf@epfl.ch> Date: Thu, 19 Oct 2023 11:49:32 +0200 Content-Transfer-Encoding: quoted-printable Message-Id: References: <871qdr15r9.fsf@epfl.ch> X-Mailer: Apple Mail (2.3654.120.0.1.15) X-Spam-Score: 0.0 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 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. From unknown Tue Aug 19 10:02:57 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: "Basil L. Contovounesios" Subject: bug#66628: closed (Re: bug#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position) Message-ID: References: <871qdr15r9.fsf@epfl.ch> X-Gnu-PR-Message: they-closed 66628 X-Gnu-PR-Package: emacs X-Gnu-PR-Keywords: patch Reply-To: 66628@debbugs.gnu.org Date: Wed, 12 Feb 2025 04:14:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1739333642-16985-1" This is a multi-part message in MIME format... ------------=_1739333642-16985-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 66628@debbugs.gnu.org. --=20 66628: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D66628 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1739333642-16985-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 66628-done) by debbugs.gnu.org; 12 Feb 2025 04:13:56 +0000 Received: from localhost ([127.0.0.1]:60110 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ti48K-0004PW-6u for submit@debbugs.gnu.org; Tue, 11 Feb 2025 23:13:56 -0500 Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:47378) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1ti48F-0004P9-Kq for 66628-done@debbugs.gnu.org; Tue, 11 Feb 2025 23:13:53 -0500 Received: by mail-ed1-x52e.google.com with SMTP id 4fb4d7f45d1cf-5de3c29ebaeso7752954a12.3 for <66628-done@debbugs.gnu.org>; Tue, 11 Feb 2025 20:13:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1739333625; x=1739938425; darn=debbugs.gnu.org; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:from:to:cc:subject:date :message-id:reply-to; bh=6On6HX5S5UnwjUmfwebZYC/UDXitLODEF3ylTgLvYX4=; b=hLg9gbmF4BC8PNf4lBilNB/mvUCnupbyI0iFxTzU72IVm7WwPlvLo7Xc/rnTgxTnyr O8M9aJmqKEwLJ2QsTmi+qxNvO9oPyzgSm/w293/lIVChxZlOYg0X4Obps0vdRG4Fhusz /lH6Mui1yYGSCw8uyu2CMo0gHzOZ8QQI+MJKILe0KTDEpXT45F2a+iRJzZptw+DnbVtI hthIjdoBac/DwAzSp9O3yt6IeU4VFSeS8XBzF2u7v0kkHp34TXbAVOWUqfj++GYh4gBP i+2CXqiFXHE8WuJp5Ic4TX2drwD41KNHPqiSTVkkwEShNXJp0hracUTevqglB6GVTjft 0/zA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1739333625; x=1739938425; h=content-transfer-encoding:cc:to:subject:message-id:date :mime-version:references:in-reply-to:from:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=6On6HX5S5UnwjUmfwebZYC/UDXitLODEF3ylTgLvYX4=; b=c5PUbdXcusfTzNBq1yh1YgXD3R4sgH9/1ET+C7rjxosf2y6YpcJ3cxQz5+CteNq59B 3veGauxVf9ezB8oAISSL8hR4oOHy5VW0IX33fgf92O3UBtNEnSBeyk2kCHpoGBReLJ4q hrDk8JAWfeErplk1xbc1/hHXaiAP1me4EtIxUN64n26j8RRtvVLJer+iefvSPK89KV+P VQipmbW6r0Eol7PtC2f5ngNePbK6b8LJ9eUJiSDQSFQRwz3Iyc0I7HSDWTadVsL+Gomr kTCOeXL/bTu7pqfDDtCauE/3ack7+rYdk2WEPq+iQ53782wfRzBHf5LGfMTdjS8vUPSQ R40w== X-Forwarded-Encrypted: i=1; AJvYcCUyfTiDhDfPHtZJJ3IrVAA0x2ckLbrVAq1tssufc1XOzGx2hf0T8auBHa6m5racDFi81yOA1bY654Xl@debbugs.gnu.org X-Gm-Message-State: AOJu0YwMdNa8g80zpaeZvRFHzPJxXQXNhj09sgfJ5Q11x+lW7LBNOb0/ cglC6zyfEaQ0IzBWUuuzExH1rD1bATMZUm8SSiWi1esXogacxquACztmOBNND9XG9eGGRfULNxV xy3VDSHxD+dlhBIWWO3zs/GcZBkU= X-Gm-Gg: ASbGncsDB0/lrDXNlYBvuA9fbsqb3GlFMx0bh3QzPrTIFPe6vu/xJuS4uRP+G1UsaeX L1PkMUfuwseP/CIB/KBvFUkVq23+WbBVFwJ6ElxTeP/Vcew9+QhJbwcN2nE1HDyaXhKSegDnD X-Google-Smtp-Source: AGHT+IFxNyG1n1+YKS2gSrbwY+GCJ1To+wflr+H5lDewzTli3jEBFkS1e1NKLERb/Tjf/9VqGh+dcVzvzIbVGfn30Dg= X-Received: by 2002:a05:6402:354e:b0:5d3:d4cf:fea0 with SMTP id 4fb4d7f45d1cf-5deadde030cmr1236723a12.21.1739333625289; Tue, 11 Feb 2025 20:13:45 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Tue, 11 Feb 2025 20:13:44 -0800 From: Stefan Kangas In-Reply-To: References: <871qdr15r9.fsf@epfl.ch> MIME-Version: 1.0 Date: Tue, 11 Feb 2025 20:13:44 -0800 X-Gm-Features: AWEUYZl55e6xeAlmKISI3j5Ro7OG99gD4RK9KfdwG9C8Agtjq2hPSqj9utxT5y4 Message-ID: Subject: Re: bug#66628: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position To: =?UTF-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 66628-done Cc: "Basil L. Contovounesios" , Alan Mackenzie , 66628-done@debbugs.gnu.org, Stefan Monnier X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Version: 31.1 Mattias Engdeg=C3=A5rd writes: > 19 okt. 2023 kl. 08.32 skrev Basil L. Contovounesios : > >> $ EMACS_GENERATE_DYNVARS=3D1 emacs -Q -batch -f batch-byte-compile foo.e= l >> Generating /tmp/foo.elc.dynvars >> >> $ cat foo.elc.dynvars >> (# . "/tmp/foo.el") >> (# . "/tmp/foo.el") > > Oops, good that you found this. The patch looks fine. > Thank you! It seems like this was never installed, so I did that now. See commit dcc4cec04ad on master. I'm consequently closing this bug report. ------------=_1739333642-16985-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 19 Oct 2023 06:33:44 +0000 Received: from localhost ([127.0.0.1]:35585 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtMbH-0002EO-F4 for submit@debbugs.gnu.org; Thu, 19 Oct 2023 02:33:44 -0400 Received: from lists.gnu.org ([2001:470:142::17]:37498) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qtMbE-0002E9-I9 for submit@debbugs.gnu.org; Thu, 19 Oct 2023 02:33:41 -0400 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 1qtMah-0003Kb-UT for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 02:33:08 -0400 Received: from mail-wm1-x336.google.com ([2a00:1450:4864:20::336]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qtMad-00013e-WB for bug-gnu-emacs@gnu.org; Thu, 19 Oct 2023 02:33:07 -0400 Received: by mail-wm1-x336.google.com with SMTP id 5b1f17b1804b1-40839807e82so2225245e9.0 for ; Wed, 18 Oct 2023 23:33:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tcd.ie; s=google21; t=1697697180; x=1698301980; darn=gnu.org; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date:message-id:reply-to; bh=d3aN8yhMwtcEGzg6kjhBMDABXsTWjt42hbcFnIPCn+M=; b=PEW79+A3jQy9+rmiAZuJGPWwZXccmhPnb1sFR24RP3+M6VQB6L+/LPQWmPn6DOSJvN LesX/3IEz912ITTxOm8jLqq6+d5BK5uCqUfkNNXTTbE3x1p3Cxl5IisV5Qg4SrS1KNhe ltQXmoNo1BOG1KYSTS/yb8G3Y5EMVn0b7ZTugWKvGs0Rnte2fk1l4sSz28pywX/w1kMO pnhyAkRnar1XiSN9eRGRfxUczcsNbP3aVTSTvlMf6CjPmpGrVWnbe1fpYtIlsrY42Z6l kIfSbbvFtdzfrYiiiHii3SqyvkZJI4tpFM9Zi5HDUm1bBeQ6hsSYhH5ROPp/feaDVWjN 72pw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697697180; x=1698301980; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=d3aN8yhMwtcEGzg6kjhBMDABXsTWjt42hbcFnIPCn+M=; b=um9incXCEwrdRs9Uv49Z3gRt1lIrXVomcCZMHqt/7S5bFkHRKcljYURlT9YcrNofwY E9WJKshbYVhBOwWdGorGzRgam/kDc4TB0CphbreAqAD2Jk8VfmpJevbrGPeQ/LN5DmZw 4wqMeNplhGQPJzuNhp+7PFjb5urirLR1Savx21HWOk3Ce0o0Won4WrSRSJdeXnnluUbD Zvk6Q7q3qn30t1+YPo48Or1MS2HwFyoXvj+ZCUtv1DdDiH6irQL9AKxCZ/sZ/g4OdSih 8uxU3lRR47iXbM10HtdMkFTW+FRoPExRiGF89mMR4221a/toTboI+fPw3ep14wyoB64x JBiQ== X-Gm-Message-State: AOJu0YwDLD+c5O6iHyef8ZklpRZcN0QDmaQKFYxG9cxzvXjetSVE0h4x rR9U5+7yxGnyg6LDyQ267wTmX2jj/+KPNbA7rxk= X-Google-Smtp-Source: AGHT+IGlwTnQUXJTEQOVxgv5935B/4pUsmHovpKi9m1xdA4nNA3FVf3x/FCG6WJ/yVII+GTZRBhjkQ== X-Received: by 2002:a05:600c:2a15:b0:400:5962:6aa9 with SMTP id w21-20020a05600c2a1500b0040059626aa9mr847862wme.11.1697697180325; Wed, 18 Oct 2023 23:33:00 -0700 (PDT) Received: from localhost ([2a02:aa12:b102:1b80:415e:345d:c031:c2fa]) by smtp.gmail.com with ESMTPSA id j22-20020a05600c1c1600b00405718cbeadsm1911604wms.1.2023.10.18.23.32.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 18 Oct 2023 23:32:59 -0700 (PDT) From: "Basil L. Contovounesios" To: bug-gnu-emacs@gnu.org Subject: 30.0.50; EMACS_GENERATE_DYNVARS emits symbols with position X-Debbugs-Cc: "Alan Mackenzie" , "Mattias =?utf-8?Q?Engdeg?= =?utf-8?Q?=C3=A5rd=22?= Date: Thu, 19 Oct 2023 08:32:58 +0200 Message-ID: <871qdr15r9.fsf@epfl.ch> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::336; envelope-from=contovob@tcd.ie; helo=mail-wm1-x336.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Severity: minor Tags: patch Given the following two files under /tmp: ;;; foo.el -*- lexical-binding: t -*- (defvar foo-x) (defvar foo-y) ;;; foo.el ends here ;;; bar.el -*- lexical-binding: t -*- (defun bar-x (foo-x) (ignore foo-x)) (let ((foo-y 1)) (ignore foo-y) (setq foo-y 2)) ;;; bar.el ends here $ EMACS_GENERATE_DYNVARS=1 emacs -Q -batch -f batch-byte-compile foo.el Generating /tmp/foo.elc.dynvars $ cat foo.elc.dynvars (# . "/tmp/foo.el") (# . "/tmp/foo.el") $ EMACS_DYNVARS_FILE=foo.elc.dynvars emacs -Q -batch -f batch-byte-compile bar.el Since the .dynvars file makes for some bad reading, the last step gives no diagnostic, though I would expect it to. Here's a patch that binds print-symbols-bare appropriately: --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-Print-bare-symbols-for-EMACS_GENERATE_DYNVARS.patch >From 492ad0f4a97ca43409eb0fefacdfe84b0775cf15 Mon Sep 17 00:00:00 2001 From: "Basil L. Contovounesios" Date: Wed, 18 Oct 2023 15:33:51 +0200 Subject: [PATCH] Print bare symbols for EMACS_GENERATE_DYNVARS * lisp/emacs-lisp/bytecomp.el (byte-compile--load-dynvars): Remove redundant goto-char. (byte-compile-file): Bind print-symbols-bare around .dynvars file generation. --- lisp/emacs-lisp/bytecomp.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index 92abe6b4624..9d97678379c 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el @@ -2069,7 +2069,6 @@ byte-compile--load-dynvars (and file (not (equal file "")) (with-temp-buffer (insert-file-contents file) - (goto-char (point-min)) (let ((vars nil) var) (while (ignore-errors (setq var (read (current-buffer)))) @@ -2284,7 +2283,8 @@ byte-compile-file (let ((gen-dynvars (getenv "EMACS_GENERATE_DYNVARS"))) (when (and gen-dynvars (not (equal gen-dynvars "")) byte-compile--seen-defvars) - (let ((dynvar-file (concat target-file ".dynvars"))) + (let ((dynvar-file (concat target-file ".dynvars")) + (print-symbols-bare t)) (message "Generating %s" dynvar-file) (with-temp-buffer (dolist (var (delete-dups byte-compile--seen-defvars)) -- 2.42.0 --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Now I get the following, as expected: $ EMACS_GENERATE_DYNVARS=3D1 emacs -Q -batch -f batch-byte-compile foo.el Generating /tmp/foo.elc.dynvars $ cat foo.elc.dynvars (foo-y . "/tmp/foo.el") (foo-x . "/tmp/foo.el") $ EMACS_DYNVARS_FILE=3Dfoo.elc.dynvars emacs -Q -batch -f batch-byte-comp= ile bar.el In bar-x: bar.el:2:2: Warning: =E2=80=98foo-x=E2=80=99 lexically bound in lambda he= re but declared dynamic in: /tmp/foo.el bar.el:3:8: Warning: =E2=80=98foo-y=E2=80=99 lexically bound in let here = but declared dynamic in: /tmp/foo.el WDYT? Side question: if I replace (let ((foo-y 1)) (ignore foo-y) (setq foo-y 2)) with (let ((foo-y 1)) (ignore foo-y) (bar-x foo-y)) 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? If so, I'm curious whether/how the .dynvars feature could be adapted to cope, e.g. by taking place at an earlier stage. Thanks, --=20 Basil In GNU Emacs 30.0.50 (build 1, x86_64-pc-linux-gnu, X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2023-10-18 built on tia Repository revision: 06fc5c24170b820939d3d51071b2957354edcb65 Repository branch: master Windowing system distributor 'The X.Org Foundation', version 11.0.12101008 System Description: Debian GNU/Linux trixie/sid Configured using: 'configure 'CFLAGS=3D-O2 -ggdb3' -C --prefix=3D/home/blc/.local --enable-checking=3Dstructs --with-file-notification=3Dyes --with-x-toolkit=3Dlucid --with-x' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XAW3D XDBE XIM XINPUT2 XPM LUCID ZLIB Important settings: value of $LANG: en_IE.UTF-8 value of $XMODIFIERS: @im=3Dibus locale-coding-system: utf-8-unix Major mode: Lisp Interaction Minor modes in effect: tooltip-mode: t global-eldoc-mode: t eldoc-mode: t show-paren-mode: t electric-indent-mode: t mouse-wheel-mode: t tool-bar-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t minibuffer-regexp-mode: t line-number-mode: t indent-tabs-mode: t transient-mark-mode: t auto-composition-mode: t auto-encryption-mode: t auto-compression-mode: t Load-path shadows: None found. Features: (shadow sort mail-extr emacsbug message mailcap yank-media puny dired dired-loaddefs rfc822 mml mml-sec password-cache epa derived epg rfc6068 epg-config gnus-util text-property-search time-date subr-x mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader cl-loaddefs cl-lib sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd touch-screen tool-bar dnd fontset image regexp-opt fringe tabulated-list replace newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq simple cl-generic indonesian philippine cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech european ethiopic indian cyrillic chinese composite emoji-zwj charscript charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp files window text-properties overlay sha1 md5 base64 format env code-pages mule custom widget keymap hashtable-print-readable backquote threads dbusbind inotify lcms2 dynamic-setting system-font-setting font-render-setting cairo x-toolkit xinput2 x multi-tty move-toolbar make-network-process emacs) Memory information: ((conses 16 38082 9280) (symbols 48 5209 0) (strings 32 14036 1774) (string-bytes 1 387105) (vectors 16 10299) (vector-slots 8 156340 16868) (floats 8 23 23) (intervals 56 259 0) (buffers 992 10)) --=-=-=-- ------------=_1739333642-16985-1--