GNU bug report logs - #55137
Different result when interpreted and when evaluating byte-compiled code

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Paul Pogonyshev <pogonyshev@HIDDEN>; dated Tue, 26 Apr 2022 22:18:01 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.

Message received at 55137 <at> debbugs.gnu.org:


Received: (at 55137) by debbugs.gnu.org; 27 Apr 2022 11:20:48 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 27 07:20:48 2022
Received: from localhost ([127.0.0.1]:41344 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njfiy-0005vM-Ek
	for submit <at> debbugs.gnu.org; Wed, 27 Apr 2022 07:20:48 -0400
Received: from smtp-3.orcon.net.nz ([60.234.4.44]:53007)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <psainty@HIDDEN>) id 1njfiv-0005vB-2p
 for 55137 <at> debbugs.gnu.org; Wed, 27 Apr 2022 07:20:46 -0400
Received: from [10.253.37.70] (port=35617 helo=webmail.orcon.net.nz)
 by smtp-3.orcon.net.nz with esmtpa (Exim 4.90_1)
 (envelope-from <psainty@HIDDEN>)
 id 1njfir-0000Xh-TZ; Wed, 27 Apr 2022 23:20:42 +1200
Received: from ip-139-180-65-103.kinect.net.nz ([139.180.65.103])
 via [10.253.37.253] by webmail.orcon.net.nz
 with HTTP (HTTP/1.1 POST); Wed, 27 Apr 2022 23:20:41 +1200
MIME-Version: 1.0
Content-Type: text/plain; charset=US-ASCII;
 format=flowed
Content-Transfer-Encoding: 7bit
Date: Wed, 27 Apr 2022 23:20:41 +1200
From: Phil Sainty <psainty@HIDDEN>
To: Paul Pogonyshev <pogonyshev@HIDDEN>
Subject: Re: bug#55137: Different result when interpreted and when
 evaluating byte-compiled code
In-Reply-To: <CAG7BpaqmWCYjdqDwQYZubgkYQdJH39wuh123+3G1P5oVhb5fJg@HIDDEN>
References: <CAG7BpaqmWCYjdqDwQYZubgkYQdJH39wuh123+3G1P5oVhb5fJg@HIDDEN>
Message-ID: <8ddae25aa2488d550ca63e396015002e@HIDDEN>
X-Sender: psainty@HIDDEN
User-Agent: Orcon Webmail
X-GeoIP: --
X-Spam_score: -2.9
X-Spam_score_int: -28
X-Spam_bar: --
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55137
Cc: 55137 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

On 2022-04-27 10:16, Paul Pogonyshev wrote:
>     (defmacro is-special-as-macro ()
>       (special-variable-p 'special-variable))

This macro does not expand to code which calls `special-variable-p'.
Rather it calls `special-variable-p' at expansion time, and expands
to the return value of that call (nil or t).

If you byte-compile your code without loading it, then your would-be
`special-variable' doesn't exist, and hence your macro was expanding
to nil rather than t.

Try this:

      (defmacro is-special-as-macro ()
        '(special-variable-p 'special-variable))


-Phil





Information forwarded to bug-gnu-emacs@HIDDEN:
bug#55137; Package emacs. Full text available.

Message received at 55137 <at> debbugs.gnu.org:


Received: (at 55137) by debbugs.gnu.org; 27 Apr 2022 09:19:36 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Apr 27 05:19:36 2022
Received: from localhost ([127.0.0.1]:41257 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njdpf-0002kW-R4
	for submit <at> debbugs.gnu.org; Wed, 27 Apr 2022 05:19:36 -0400
Received: from mail-ed1-f42.google.com ([209.85.208.42]:37855)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pogonyshev@HIDDEN>) id 1njdpe-0002kH-GU
 for 55137 <at> debbugs.gnu.org; Wed, 27 Apr 2022 05:19:35 -0400
Received: by mail-ed1-f42.google.com with SMTP id k27so1204833edk.4
 for <55137 <at> debbugs.gnu.org>; Wed, 27 Apr 2022 02:19:34 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:references:in-reply-to:from:date:message-id:subject:to
 :cc; bh=/Zp1m2IGpnpM2+kyYegAYOiX/dfo7pwn6zA56d4xMww=;
 b=CDg7kev2i/X2T19rjD2APQhIewFIayLVfgPs91+1mHuggARgyR9k7fY89N55GqPwUe
 u3Xj9EsHYmoMqIp29dx3KIC1H0+YOBfdt96HMpb+r2xnZTkcTJUgDt+EKy5K+ZLsEBQ1
 T6Ru1nlBKWXdmonCp49eetEltZbpBn0z4DokjefwLFd0N6O9Hsm9d7tBAJge1Z2O5Sc9
 mOrfJRXlhFTEveh8fc62JWrGPRikbbU6Dtqc3PEY/VWwYfzqT5NX0/aa/d6hAge42A/z
 4VvZYgWD+0ROmWRbpXNtMv0LBtqIu3b6YPxi8FzSYnHOPh2+cz2p6H3s9R8787lUIL4D
 eeYA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:references:in-reply-to:from:date
 :message-id:subject:to:cc;
 bh=/Zp1m2IGpnpM2+kyYegAYOiX/dfo7pwn6zA56d4xMww=;
 b=Sp4WKGfiJQS4F0PhDnxa8oRXRpjkXPRzD1qu7vSJhRhfowoaWErGORypzx1zvw/ARX
 64PFuXLJuF84nuC2OYPjws0Tb0afKc4s18zfxYnNglXZxJMmInuettg8+LUN/6NuNepR
 f02eO8YNn6iphARcSqAYpxGMP9bAia0B4WrLnBs2z/QRvGouYwoaKciF9TaIx4dEOqt2
 +4wcoVHa6BxQB6xQtL4NcSMOQVSWiUOYEa4bkPMrCKz7kNA/uL2m2T5vAGWR+elFOve+
 7SkgPc222zuI0vkheWmBTEIrgW75dwJpCrHrOWcZxhSERO57Kdas8tAKOEHgA5K/z05Y
 So0g==
X-Gm-Message-State: AOAM530r27GEmtBTNuFPeptD64OnKreo4kVrtKxeafMcOnqgQ8XQjzid
 k7i7k4by9rzke91z9uE+YyRdOzH+cUAssNrKkA==
X-Google-Smtp-Source: ABdhPJyAVR9MjDsnxjerjvsaEjWoYh4GLaa228L98KfZI9HmGCXUuNF53s/2VJKqpV1XE5W2pZ0hzO/YmGvmQ4yKSiA=
X-Received: by 2002:a05:6402:5191:b0:423:fa7f:f4c2 with SMTP id
 q17-20020a056402519100b00423fa7ff4c2mr29658993edd.9.1651051168462; Wed, 27
 Apr 2022 02:19:28 -0700 (PDT)
MIME-Version: 1.0
References: <CAG7BpaqmWCYjdqDwQYZubgkYQdJH39wuh123+3G1P5oVhb5fJg@HIDDEN>
 <83k0bbl0qa.fsf@HIDDEN>
In-Reply-To: <83k0bbl0qa.fsf@HIDDEN>
From: Paul Pogonyshev <pogonyshev@HIDDEN>
Date: Wed, 27 Apr 2022 11:19:17 +0200
Message-ID: <CAG7BpaoK6oBtRLmDtjeLTybRfB=G4xHa3zdK5VDnRYPb8+vc=Q@HIDDEN>
Subject: Re: bug#55137: Different result when interpreted and when evaluating
 byte-compiled code
To: Eli Zaretskii <eliz@HIDDEN>
Content-Type: multipart/alternative; boundary="00000000000066fb2405dd9f4e2b"
X-Spam-Score: -0.0 (/)
X-Debbugs-Envelope-To: 55137
Cc: 55137 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -1.0 (-)

--00000000000066fb2405dd9f4e2b
Content-Type: text/plain; charset="UTF-8"

Originally reproduced with 27.2. I now upgraded to 28.1. Pretty sure it is
the same with master.

In GNU Emacs 28.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.33,
cairo version 1.16.0)
 of 2022-04-27 built on gonzo
Repository revision: b511f5c05ced05fc7d1e403002bc5ba782879cba
Repository branch: emacs-28
Windowing system distributor 'The X.Org Foundation', version 11.0.12014000
System Description: Debian GNU/Linux bookworm/sid

Configured using:
 'configure --with-x-toolkit=gtk2'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG
LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUND
THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK2 ZLIB

Important settings:
  value of $LC_MONETARY: de_AT.UTF-8
  value of $LC_NUMERIC: ru_RU.UTF-8
  value of $LC_TIME: de_DE.UTF-8
  value of $LANG: en_CA.UTF-8
  locale-coding-system: utf-8-unix

On Wed, 27 Apr 2022 at 04:27, Eli Zaretskii <eliz@HIDDEN> wrote:

> > From: Paul Pogonyshev <pogonyshev@HIDDEN>
> > Date: Wed, 27 Apr 2022 00:16:42 +0200
> >
> > I'm not absolutely sure if it is a bug or a "feature", but it is
> > extremely confusing.
>
> Thanks, but please tell in what version of Emacs is this, and
> preferably show the information about your build that's collected by
> "M-x report-emacs-bug".
>

--00000000000066fb2405dd9f4e2b
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div>Originally reproduced with 27.2. I now upgraded to 28=
.1. Pretty sure it is the same with master.</div><div><br></div>In GNU Emac=
s 28.1.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 2.24.33, cairo versio=
n 1.16.0)<br>=C2=A0of 2022-04-27 built on gonzo<br>Repository revision: b51=
1f5c05ced05fc7d1e403002bc5ba782879cba<br>Repository branch: emacs-28<br>Win=
dowing system distributor &#39;The X.Org Foundation&#39;, version 11.0.1201=
4000<br>System Description: Debian GNU/Linux bookworm/sid<br><br>Configured=
 using:<br>=C2=A0&#39;configure --with-x-toolkit=3Dgtk2&#39;<br><br>Configu=
red features:<br>CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ=
 JPEG<br>LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG SECCOMP SOUN=
D<br>THREADS TIFF TOOLKIT_SCROLL_BARS X11 XDBE XIM XPM GTK2 ZLIB<br><br>Imp=
ortant settings:<br>=C2=A0 value of $LC_MONETARY: de_AT.UTF-8<br>=C2=A0 val=
ue of $LC_NUMERIC: ru_RU.UTF-8<br>=C2=A0 value of $LC_TIME: de_DE.UTF-8<br>=
=C2=A0 value of $LANG: en_CA.UTF-8<br>=C2=A0 locale-coding-system: utf-8-un=
ix<br></div><br><div class=3D"gmail_quote"><div dir=3D"ltr" class=3D"gmail_=
attr">On Wed, 27 Apr 2022 at 04:27, Eli Zaretskii &lt;<a href=3D"mailto:eli=
z@HIDDEN">eliz@HIDDEN</a>&gt; wrote:<br></div><blockquote class=3D"gmail_=
quote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,=
204);padding-left:1ex">&gt; From: Paul Pogonyshev &lt;<a href=3D"mailto:pog=
onyshev@HIDDEN" target=3D"_blank">pogonyshev@HIDDEN</a>&gt;<br>
&gt; Date: Wed, 27 Apr 2022 00:16:42 +0200<br>
&gt; <br>
&gt; I&#39;m not absolutely sure if it is a bug or a &quot;feature&quot;, b=
ut it is<br>
&gt; extremely confusing.<br>
<br>
Thanks, but please tell in what version of Emacs is this, and<br>
preferably show the information about your build that&#39;s collected by<br=
>
&quot;M-x report-emacs-bug&quot;.<br>
</blockquote></div>

--00000000000066fb2405dd9f4e2b--




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#55137; Package emacs. Full text available.

Message received at 55137 <at> debbugs.gnu.org:


Received: (at 55137) by debbugs.gnu.org; 27 Apr 2022 02:27:45 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 26 22:27:45 2022
Received: from localhost ([127.0.0.1]:40842 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njXP7-0000VP-KZ
	for submit <at> debbugs.gnu.org; Tue, 26 Apr 2022 22:27:45 -0400
Received: from eggs.gnu.org ([209.51.188.92]:37392)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1njXP5-0000VA-C4
 for 55137 <at> debbugs.gnu.org; Tue, 26 Apr 2022 22:27:45 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e]:45506)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1njXP0-0005qR-2a; Tue, 26 Apr 2022 22:27:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=exzYm/sr8Od7+6gLZmPMIBE8YIiH94UtBd10MOlpDvM=; b=POOFclLC1huL
 2spp6FG7fXz10VeKGyJdqzOdqZc6fTX7+DIYn9sfT9aCoevzo7QrtfTIs8c6+VrULnhmPkPL4Q1II
 4ZP2QMKYSn51QjJh/xGSbSguN2uMsRNztv3l70A8YX+w3sj3HD5/YQiE+JNTK4DI5IdvdvOGWCxGR
 CYEbotcrpe5A6MpQVLkFTTiqaGItZrELdW6F9Evx7LOapDBEhFos1WSemqSpVs0Qe4+iSDtAFvnds
 sMS51OnBbLX0mCwo+7qgtr2dNhXLBN8q3Ygwru4t7bWwtgQT6QSstWgTurBxhUkhfrzPRwvJK2yJo
 MRna3T6mxdlS8qDvHuB/4g==;
Received: from [87.69.77.57] (port=1064 helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1njXOz-0005ME-Hf; Tue, 26 Apr 2022 22:27:37 -0400
Date: Wed, 27 Apr 2022 05:27:25 +0300
Message-Id: <83k0bbl0qa.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Paul Pogonyshev <pogonyshev@HIDDEN>
In-Reply-To: <CAG7BpaqmWCYjdqDwQYZubgkYQdJH39wuh123+3G1P5oVhb5fJg@HIDDEN>
 (message from Paul Pogonyshev on Wed, 27 Apr 2022 00:16:42 +0200)
Subject: Re: bug#55137: Different result when interpreted and when evaluating
 byte-compiled code
References: <CAG7BpaqmWCYjdqDwQYZubgkYQdJH39wuh123+3G1P5oVhb5fJg@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 55137
Cc: 55137 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> From: Paul Pogonyshev <pogonyshev@HIDDEN>
> Date: Wed, 27 Apr 2022 00:16:42 +0200
> 
> I'm not absolutely sure if it is a bug or a "feature", but it is
> extremely confusing.

Thanks, but please tell in what version of Emacs is this, and
preferably show the information about your build that's collected by
"M-x report-emacs-bug".




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#55137; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 26 Apr 2022 22:17:01 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Apr 26 18:17:01 2022
Received: from localhost ([127.0.0.1]:40700 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1njTUT-0002gY-02
	for submit <at> debbugs.gnu.org; Tue, 26 Apr 2022 18:17:01 -0400
Received: from lists.gnu.org ([209.51.188.17]:33074)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <pogonyshev@HIDDEN>) id 1njTUP-0002gP-T0
 for submit <at> debbugs.gnu.org; Tue, 26 Apr 2022 18:17:00 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10]:36394)
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <pogonyshev@HIDDEN>)
 id 1njTUP-0006s1-MZ
 for bug-gnu-emacs@HIDDEN; Tue, 26 Apr 2022 18:16:57 -0400
Received: from mail-ed1-x529.google.com ([2a00:1450:4864:20::529]:36381)
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <pogonyshev@HIDDEN>)
 id 1njTUN-0001BS-Uo
 for bug-gnu-emacs@HIDDEN; Tue, 26 Apr 2022 18:16:57 -0400
Received: by mail-ed1-x529.google.com with SMTP id a1so18388716edt.3
 for <bug-gnu-emacs@HIDDEN>; Tue, 26 Apr 2022 15:16:54 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112;
 h=mime-version:from:date:message-id:subject:to;
 bh=o7F/mO8l0vxecJpCZTRnKkKQSCsskjPCRp6AIfbJpuI=;
 b=qXdp2vQh9WbIZzSkYyiPycP+nausWmoZU0Ku8cEtuFjQViLZHYGuhr6rTWDh5KqT85
 641CrXO1gK1dRB1fhajCqtvxMXkhUPqD6k+nLllZcVhUzFAiuTZWOJBRO21FuHcr/jRf
 YgkWPVoA5AqOPQTOcTEsIH2nOqgDkwKwth82dh7Uz37oyNT0LcPTo66XJzJ/cHK8+avn
 VmQrkz4bwmwxLR+nk6Ww9itctqsn/5cdbm2Qgg++53bO2d1RmNnWQ71yBwzTqZln9Sjs
 8Z0jJd5jU17qT2ymVrG7bBfFg2ZOkuwSQXfpQbRQJzRCQhdPbbG75u85qrUtwrXVS24B
 DOlA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=x-gm-message-state:mime-version:from:date:message-id:subject:to;
 bh=o7F/mO8l0vxecJpCZTRnKkKQSCsskjPCRp6AIfbJpuI=;
 b=ZXoBkT2zxPYldTLS1U7qTtZryd/I6AFjTkVqpxAnEEhA2QbOmT8Ks49jhkks4ROcLc
 EUePFWKey5I1pEnMER06uZn/sLlDvZ1MyfxZ+12XUlS7AfwAkeRL0jq7Ox8g7zQs2NPX
 TChqYwiTPXcRj/Aw3npXJL6wQDFQM2Tb7KcH51+sn3QPq/n03BOr40uKF86pzuOoFZ75
 bfQJAsv9qTJ3ZpYGJobsDCzMxQbpkciqZXcf46kggO1/jkEX4Omkl5K/5/EJOT4kSqwQ
 /aBQjZ1wcy8hguZWVZZnWVprphodqmIK7prue6hHNpY0YbQSlVhvRBtF+INsr7sjMYyZ
 fSYg==
X-Gm-Message-State: AOAM533PJiehLbRz6HWYafJV+tIGbLtfY8gjgpr8weipvuv4BRc11wwZ
 +Gx+UMqImklQey6TpM1igEw/Ugux0jzQT6aLWRL/8QxKzIjF
X-Google-Smtp-Source: ABdhPJwyN3k0L9PJakeYdQCNaPfVTwmwpQhtWZrdgUpn3jlx+zjiQMWMmkF/mHmU5J9uAsByTsjOvi6hpnsI5XmFIGY=
X-Received: by 2002:a05:6402:330b:b0:425:eded:7cfe with SMTP id
 e11-20020a056402330b00b00425eded7cfemr11713143eda.357.1651011413651; Tue, 26
 Apr 2022 15:16:53 -0700 (PDT)
MIME-Version: 1.0
From: Paul Pogonyshev <pogonyshev@HIDDEN>
Date: Wed, 27 Apr 2022 00:16:42 +0200
Message-ID: <CAG7BpaqmWCYjdqDwQYZubgkYQdJH39wuh123+3G1P5oVhb5fJg@HIDDEN>
Subject: Different result when interpreted and when evaluating byte-compiled
 code
To: bug-gnu-emacs@HIDDEN
Content-Type: multipart/alternative; boundary="000000000000d4b4ca05dd960c7f"
Received-SPF: pass client-ip=2a00:1450:4864:20::529;
 envelope-from=pogonyshev@HIDDEN; helo=mail-ed1-x529.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, FREEMAIL_FROM=0.001,
 HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001,
 SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

--000000000000d4b4ca05dd960c7f
Content-Type: text/plain; charset="UTF-8"

I'm not absolutely sure if it is a bug or a "feature", but it is
extremely confusing.

To reproduce: store this as file `test.el':

    (defvar special-variable nil)

    (defmacro is-special-as-macro ()
      (special-variable-p 'special-variable))

    (defun is-special-as-function ()
      (is-special-as-macro))

    (print (is-special-as-function))
    (print (eval '(is-special-as-macro)))

Now, from command line:

    $ rm -f test.elc; emacs --batch -l test.el

This loads the file as interpreted Elisp and prints `t' two times,
i.e. always recognizes the variable as special.

Next, byte-compile the file before loading:

    $ rm -f test.elc; emacs --batch --eval "(byte-compile-file
\"test.el\")"; emacs --batch -l test.elc

This prints `nil' and `t', i.e. variable is now considered non-special
by `is-special-as-function'.  From investigating `.elc' file, it is
apparent that this is encoded into it as a macroexpanded constant.
Note that `is-special-as-macro' still works fine, the problem appears
only when it gets macroexpanded during byte-compilation.

So, apparently `defvar' form is sort of "skipped without paying
attention" during byte-compilation.  If I put it into an
`eval-and-compile' form, then macroexpansion does produce expected
result.

I noticed this with code using `iter2' library.  When `iter2-defun'
generator functions get macroexpanded during compilation, built-in
`special-variable-p' is called, because for generator functions this
is important to distinguish between local and dynamic variables.  The
example above is derived from debugging real failure.

Standard `generator' package is also affected.  Here is example code:

    ;;; -*- lexical-binding: t -*-

    (require 'generator)

    (defvar special-variable nil)

    (defun get-special-variable ()
      special-variable)

    (iter-defun buggy ()
      (let ((special-variable t))
        (iter-yield (get-special-variable))))

    (print (iter-next (buggy)))

As before, save as `test.el' and execute the same two commands.
Produced output is different depending on whether the file has been
byte-compiled or not.

Is `eval-and-compile' the proper workaround?  Can things be made less
confusing by noticing declared special variables during
byte-compilation?

Paul

--000000000000d4b4ca05dd960c7f
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">I&#39;m not absolutely sure if it is a bug or a &quot;feat=
ure&quot;, but it is<br>extremely confusing.<br><br>To reproduce: store thi=
s as file `test.el&#39;:<br><br>=C2=A0 =C2=A0 (defvar special-variable nil)=
<br><br>=C2=A0 =C2=A0 (defmacro is-special-as-macro ()<br>=C2=A0 =C2=A0 =C2=
=A0 (special-variable-p &#39;special-variable))<br><br>=C2=A0 =C2=A0 (defun=
 is-special-as-function ()<br>=C2=A0 =C2=A0 =C2=A0 (is-special-as-macro))<b=
r><br>=C2=A0 =C2=A0 (print (is-special-as-function))<br>=C2=A0 =C2=A0 (prin=
t (eval &#39;(is-special-as-macro)))<br><br>Now, from command line:<br><br>=
=C2=A0 =C2=A0 $ rm -f test.elc; emacs --batch -l test.el<br><br>This loads =
the file as interpreted Elisp and prints `t&#39; two times,<br>i.e. always =
recognizes the variable as special.<br><br>Next, byte-compile the file befo=
re loading:<br><br>=C2=A0 =C2=A0 $ rm -f test.elc; emacs --batch --eval &qu=
ot;(byte-compile-file \&quot;test.el\&quot;)&quot;; emacs --batch -l test.e=
lc<br><br>This prints `nil&#39; and `t&#39;, i.e. variable is now considere=
d non-special<br>by `is-special-as-function&#39;.=C2=A0 From investigating =
`.elc&#39; file, it is<br>apparent that this is encoded into it as a macroe=
xpanded constant.<br>Note that `is-special-as-macro&#39; still works fine, =
the problem appears<br>only when it gets macroexpanded during byte-compilat=
ion.<br><br>So, apparently `defvar&#39; form is sort of &quot;skipped witho=
ut paying<br>attention&quot; during byte-compilation.=C2=A0 If I put it int=
o an<br>`eval-and-compile&#39; form, then macroexpansion does produce expec=
ted<br>result.<br><br>I noticed this with code using `iter2&#39; library.=
=C2=A0 When `iter2-defun&#39;<br>generator functions get macroexpanded duri=
ng compilation, built-in<br>`special-variable-p&#39; is called, because for=
 generator functions this<br>is important to distinguish between local and =
dynamic variables.=C2=A0 The<br>example above is derived from debugging rea=
l failure.<br><br><div>Standard `generator&#39; package is also affected.=
=C2=A0 Here is example code:<br><br>=C2=A0 =C2=A0 ;;; -*- lexical-binding: =
t -*-<br><br>=C2=A0 =C2=A0 (require &#39;generator)<br><br>=C2=A0 =C2=A0 (d=
efvar special-variable nil)<br><br>=C2=A0 =C2=A0 (defun get-special-variabl=
e ()<br>=C2=A0 =C2=A0 =C2=A0 special-variable)<br><br>=C2=A0 =C2=A0 (iter-d=
efun buggy ()<br>=C2=A0 =C2=A0 =C2=A0 (let ((special-variable t))<br>=C2=A0=
 =C2=A0 =C2=A0 =C2=A0 (iter-yield (get-special-variable))))<br><br>=C2=A0 =
=C2=A0 (print (iter-next (buggy)))<br><br>As before, save as `test.el&#39; =
and execute the same two commands.<br>Produced output is different dependin=
g on whether the file has been<br>byte-compiled or not.<br><br>Is `eval-and=
-compile&#39; the proper workaround?=C2=A0 Can things be made less<br>confu=
sing by noticing declared special variables during<br>byte-compilation?<br>=
<br>Paul<br></div></div>

--000000000000d4b4ca05dd960c7f--




Acknowledgement sent to Paul Pogonyshev <pogonyshev@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#55137; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Wed, 27 Apr 2022 11:30:02 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.