GNU bug report logs - #71555
29.3.50; Native-compilation sets some variable to nil unexpectedly.

Previous Next

Package: emacs;

Reported by: Sévère Durand <mmemmew <at> gmail.com>

Date: Fri, 14 Jun 2024 16:14:02 UTC

Severity: normal

Found in version 29.3.50

Done: Andrea Corallo <acorallo <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Gerd Möllmann <gerd.moellmann <at> gmail.com>
To: Sévère Durand <mmemmew <at> gmail.com>
Cc: 71555 <at> debbugs.gnu.org, Andrea Corallo <acorallo <at> gnu.org>
Subject: bug#71555: 29.3.50; Native-compilation sets some variable to nil unexpectedly.
Date: Sun, 16 Jun 2024 14:46:07 +0200
Sévère Durand <mmemmew <at> gmail.com> writes:

> 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

I can reproduce this on macOS 14.5 x86-64 on the emacs-29 branch but not
on master. Maybe Andrea (CC'd) can help.




This bug report was last modified 1 year and 8 days ago.

Previous Next


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