From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: =?UTF-8?Q?S=C3=A9v=C3=A8re?= Durand Newsgroups: gmane.emacs.bugs Subject: bug#71555: 29.3.50; Native-compilation sets some variable to nil unexpectedly. Date: Fri, 14 Jun 2024 22:55:56 +0800 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="000000000000d218a0061adad036" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="29146"; mail-complaints-to="usenet@ciao.gmane.io" To: 71555@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Jun 14 18:14:11 2024 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 1sI9Z5-0007ST-KM for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 14 Jun 2024 18:14:11 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sI9Yy-00076H-5T; Fri, 14 Jun 2024 12:14: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 1sI9Yw-00075t-Rm for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 12:14:02 -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 1sI9Yw-0008QU-Jv for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 12:14:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sI9Yw-0001gm-P9 for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 12:14:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: =?UTF-8?Q?S=C3=A9v=C3=A8re?= Durand Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 14 Jun 2024 16:14:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 71555 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17183815846389 (code B ref -1); Fri, 14 Jun 2024 16:14:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Jun 2024 16:13:04 +0000 Original-Received: from localhost ([127.0.0.1]:40810 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sI9Xy-0001el-7u for submit@debbugs.gnu.org; Fri, 14 Jun 2024 12:13:03 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:33868) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sI8Lf-00086t-9V for submit@debbugs.gnu.org; Fri, 14 Jun 2024 10:56:16 -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 1sI8Le-0000zl-CE for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 10:56:14 -0400 Original-Received: from mail-ej1-x632.google.com ([2a00:1450:4864:20::632]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sI8Lb-0002mp-MJ for bug-gnu-emacs@gnu.org; Fri, 14 Jun 2024 10:56:13 -0400 Original-Received: by mail-ej1-x632.google.com with SMTP id a640c23a62f3a-a6265d48ec3so325470766b.0 for ; Fri, 14 Jun 2024 07:56:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1718376969; x=1718981769; darn=gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=495T5R7TOgw29q811pZBgChYK21oFjCRDrQtMYT4lBk=; b=eubcRWKk69nMQcVeQsN6awdnmsuTFNxfQXBDh+fASUnKQhAboOkNltYSfOy/WiBjyK dvepANygJxeDGNqb7Wx+whE3spQxe2sI/vBgEtuHAVtawRhy6SAuUdotAKS/1OZVtzJR o0DnQjr9S4iZvM3PuN3Fq6eEFWGUFPLmQgLQqoVQTKluN6P9kwsQ8EsMrjw/cau3fweS DZvFgydWdFacFUUmY5E2zOkYAkmX/IIDRIAmOnNAXP0J9TaqzPVgnRUYeZ6rqxs2n2C3 y1vAje7lXR/jNDjWMB3fXVbUoOEqA0k4FFgC4zg++b24OsVwVEl5SS2EkhmE3YgGFsrT 8CpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718376969; x=1718981769; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=495T5R7TOgw29q811pZBgChYK21oFjCRDrQtMYT4lBk=; b=n91Fe+TaKuggMcQ7dFEjvu1xbA3xf+quBLugXsLmCTIJ52Ay4QKFbQyHm0Pg+WnwDI YLE1jVFToclFyKS1BBVeJhKoARlqTbzLZ/4wJItcEwmII5vVaPEhn9MyZyq6CvM2K4mP Mm3cUud25LNTeNTP8dVSDi2iQ+pGGyWXu/Q/DTsgSEFgSWQ/GtojqDfOzlChnf9w5k+9 F0k+7XTe8gcVaj1gYhmpKEmFDEoT4lkyyEQ9wG7SoCoI4TkiMxpVPf5WvQasA+eJB9BV M63iD1zmi5zV2DO+B2y6GA/2ksiWEsa0By1/CxhXf0qWD+EaUvrW1LEgK+ChUEFMRCWz KzkQ== X-Gm-Message-State: AOJu0YwNOWYWTnl7FGnBIeZ5JAaKOJD1COlUTmRkZNC9okbDZ/A3jkgl IUysZ7phE3wtnKQK9TtEj2QsPmarFk7HQi/4AlYwgMT8aPl2XmxZHOMv7rgjcRVk1pxMlGLAL/0 TV6e1Kxc3uJTxgKa++F/FML3MPVE/y/XJ X-Google-Smtp-Source: AGHT+IGi/4qG4WkvfX6Qma9qf5mCP1jR7WTknS2yaTszoTOMFMZY8fmw7f8bakfsgKtUjfC6MLvW7C2bD+VymBthhBs= X-Received: by 2002:a17:906:814:b0:a6e:f646:6fdb with SMTP id a640c23a62f3a-a6f60de2524mr167164766b.72.1718376968882; Fri, 14 Jun 2024 07:56:08 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::632; envelope-from=mmemmew@gmail.com; helo=mail-ej1-x632.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-Mailman-Approved-At: Fri, 14 Jun 2024 12:13:00 -0400 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:287230 Archived-At: --000000000000d218a0061adad036 Content-Type: text/plain; charset="UTF-8" Hello: I recently found that sometimes an argument of a function is unexpectedly set to nil when the function is natively compiled. A recipe to reproduce the behaviour is as follows. ```elisp (defun test (&optional start) "Test the values of START." (message "start is %S" start) (cond ((not (integer-or-marker-p start)) (message "entered first cond variant") (setq start nil)) ((and (markerp start) (not (equal (marker-buffer start) (current-buffer)))) (message "entered second cond variant") (setq start nil))) (message "start is %S" start)) (native-compile 'test) (test 12) ``` When I evaluate the above forms in sequence, I got the following two messages: start is 12 start is nil As can be seen from the above, no `cond` variants are triggered, so the variable START should have the value 12, while it becomes nil at the end. Sorry if this example is not minimal: I found this behaviour in my package, so copied the relevant parts here. I am not sure what a minimal example would be. Hope this report is helpful. --- In GNU Emacs 29.3.50 (build 1, x86_64-apple-darwin23.4.0, NS appkit-2487.50 Version 14.4.1 (Build 23E224)) of 2024-06-12 built on MacBook-Pro-de-Severe.local Repository revision: 59261e6f4fef0ec03c8127b29fe107ed19280a3b Repository branch: emacs-29 Windowing system distributor 'Apple', version 10.3.2487 System Description: macOS 14.4.1 Configured using: 'configure --with-ns --without-tree-sitter --with-native-compilation=yes' Configured features: ACL DBUS GIF GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP NOTIFY KQUEUE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP XIM ZLIB Important settings: value of $LC_ALL: fr_FR.UTF-8 value of $LC_COLLATE: fr_FR.UTF-8 value of $LC_CTYPE: fr_FR.UTF-8 value of $LC_MESSAGES: fr_FR.UTF-8 value of $LC_MONETARY: fr_FR.UTF-8 value of $LC_NUMERIC: fr_FR.UTF-8 value of $LC_TIME: fr_FR.UTF-8 value of $LANG: en_US.UTF-8 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 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 mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils time-date cl-print byte-opt debug backtrace find-func misearch multi-isearch vc-git diff-mode easy-mmode vc-dispatcher shortdoc text-property-search thingatpt help-fns radix-tree format-spec comp comp-cstr warnings icons subr-x rx cl-seq cl-macs gv cl-extra help-mode cl-loaddefs cl-lib bytecomp byte-compile face-remap rmc iso-transl tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks lisp-float-type elisp-mode mwheel term/ns-win ns-win ucs-normalize mule-util term/common-win 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 kqueue cocoa ns lcms2 multi-tty make-network-process native-compile emacs) Memory information: ((conses 16 115764 6238) (symbols 48 8233 1) (strings 32 30416 2847) (string-bytes 1 896655) (vectors 16 21051) (vector-slots 8 395280 10306) (floats 8 95 77) (intervals 56 866 15) (buffers 976 16)) --- Durand --000000000000d218a0061adad036 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hello:

I recently found that sometimes an argument = of a function is
unexpectedly set to nil when the function is natively c= ompiled.

A recipe to reproduce the behaviour is as follows.

`= ``elisp
(defun test (&optional start)
=C2=A0 "Test the value= s of START."
=C2=A0 (message "start is %S" start)
=C2= =A0 (cond
=C2=A0 =C2=A0((not (integer-or-marker-p start))
=C2=A0 =C2= =A0 (message "entered first cond variant")
=C2=A0 =C2=A0 (setq= start nil))
=C2=A0 =C2=A0((and
=C2=A0 =C2=A0 =C2=A0(markerp start)=C2=A0 =C2=A0 =C2=A0(not (equal (marker-buffer start) (current-buffer))))=
=C2=A0 =C2=A0 (message "entered second cond variant")
=C2= =A0 =C2=A0 (setq start nil)))
=C2=A0 (message "start is %S" st= art))
(native-compile 'test)
(test 12)
```

When I evalu= ate the above forms in sequence, I got the following two
messages:
start is 12
start is nil

As can be seen from the above, no `con= d` variants are triggered, so the
variable START should have the value 1= 2, while it becomes nil at the
end.

Sorry if this example is not = minimal: I found this behaviour in my
package, so copied the relevant pa= rts here.=C2=A0 I am not sure what a=C2=A0
minimal example would be.
Hope this report is helpful.
---
In GNU Emacs 29.3.50 (buil= d 1, x86_64-apple-darwin23.4.0, NS
=C2=A0appkit-2487.50 Version 14.4.1 (= Build 23E224)) of 2024-06-12 built on
=C2=A0MacBook-Pro-de-Severe.local<= br>Repository revision: 59261e6f4fef0ec03c8127b29fe107ed19280a3b
Reposit= ory branch: emacs-29
Windowing system distributor 'Apple', versi= on 10.3.2487
System Description: =C2=A0macOS 14.4.1

Configured us= ing:
=C2=A0'configure --with-ns --without-tree-sitter
=C2=A0--wit= h-native-compilation=3Dyes'

Configured features:
ACL DBUS GIF= GLIB GMP GNUTLS JPEG JSON LCMS2 LIBXML2 MODULES NATIVE_COMP
NOTIFY KQUE= UE NS PDUMPER PNG RSVG SQLITE3 THREADS TIFF
TOOLKIT_SCROLL_BARS WEBP XIM= ZLIB

Important settings:
=C2=A0 value of $LC_ALL: fr_FR.UTF-8=C2=A0 value of $LC_COLLATE: fr_FR.UTF-8
=C2=A0 value of $LC_CTYPE: fr_= FR.UTF-8
=C2=A0 value of $LC_MESSAGES: fr_FR.UTF-8
=C2=A0 value of $L= C_MONETARY: fr_FR.UTF-8
=C2=A0 value of $LC_NUMERIC: fr_FR.UTF-8
=C2= =A0 value of $LC_TIME: fr_FR.UTF-8
=C2=A0 value of $LANG: en_US.UTF-8=C2=A0 locale-coding-system: utf-8-unix

Major mode: Lisp Interactio= n

Minor modes in effect:
=C2=A0 tooltip-mode: t
=C2=A0 global-= eldoc-mode: t
=C2=A0 eldoc-mode: t
=C2=A0 show-paren-mode: t
=C2= =A0 electric-indent-mode: t
=C2=A0 mouse-wheel-mode: t
=C2=A0 tool-ba= r-mode: t
=C2=A0 menu-bar-mode: t
=C2=A0 file-name-shadow-mode: t
= =C2=A0 global-font-lock-mode: t
=C2=A0 font-lock-mode: t
=C2=A0 blink= -cursor-mode: t
=C2=A0 line-number-mode: t
=C2=A0 indent-tabs-mode: t=
=C2=A0 transient-mark-mode: t
=C2=A0 auto-composition-mode: t
=C2= =A0 auto-encryption-mode: t
=C2=A0 auto-compression-mode: t

Load-= path shadows:
None found.

Features:
(shadow sort mail-extr ema= csbug message mailcap yank-media puny dired
dired-loaddefs rfc822 mml mm= l-sec password-cache epa derived epg rfc6068
epg-config gnus-util mm-dec= ode mm-bodies mm-encode mail-parse rfc2231
mailabbrev gmm-utils mailhead= er sendmail rfc2047 rfc2045 ietf-drums
mm-util mail-prsvr mail-utils tim= e-date cl-print byte-opt debug
backtrace find-func misearch multi-isearc= h vc-git diff-mode easy-mmode
vc-dispatcher shortdoc text-property-searc= h thingatpt help-fns
radix-tree format-spec comp comp-cstr warnings icon= s subr-x rx cl-seq
cl-macs gv cl-extra help-mode cl-loaddefs cl-lib byte= comp byte-compile
face-remap rmc iso-transl tooltip cconv eldoc paren el= ectric uniquify
ediff-hook vc-hooks lisp-float-type elisp-mode mwheel te= rm/ns-win ns-win
ucs-normalize mule-util term/common-win tool-bar dnd fo= ntset image
regexp-opt fringe tabulated-list replace newcomment text-mod= e 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-c= ore
term/tty-colors frame minibuffer nadvice seq simple cl-generic
in= donesian philippine cham georgian utf-8-lang misc-lang vietnamese
tibeta= n thai tai-viet lao korean japanese eucjp-ms cp51932 hebrew greek
romani= an slovak czech european ethiopic indian cyrillic chinese
composite emoj= i-zwj charscript charprop case-table epa-hook
jka-cmpr-hook help abbrev = obarray oclosure cl-preloaded button loaddefs
theme-loaddefs faces cus-f= ace macroexp files window text-properties
overlay sha1 md5 base64 format= env code-pages mule custom widget keymap
hashtable-print-readable backq= uote threads dbusbind kqueue cocoa ns
lcms2 multi-tty make-network-proce= ss native-compile emacs)

Memory information:
((conses 16 115764 6= 238)
=C2=A0(symbols 48 8233 1)
=C2=A0(strings 32 30416 2847)
=C2= =A0(string-bytes 1 896655)
=C2=A0(vectors 16 21051)
=C2=A0(vector-slo= ts 8 395280 10306)
=C2=A0(floats 8 95 77)
=C2=A0(intervals 56 866 15)=
=C2=A0(buffers 976 16))
---
Durand


=
--000000000000d218a0061adad036--