unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD)
@ 2024-12-10 16:55 Eric Marsden
  2024-12-10 21:21 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Eric Marsden @ 2024-12-10 16:55 UTC (permalink / raw)
  To: 74771

[-- Attachment #1: Type: text/plain, Size: 671 bytes --]

Hi,

With the attached source file, Emacs miscompiles the struct predicate such
that a repeated call to the predicate on a non-struct object returns t.
This occurs with current HEAD on Linux/AMD64, but not on the Emacs 30.0.92
pretest. It does not occur when the lexical binding cookie is not present.

% /opt/emacs/bin/emacs -Q --batch --eval "(load (native-compile \"/tmp/bug.el\"))" -f run
Loading /home/emarsden/.emacs.d/eln-cache/31.0.50-c021c983/bug-59c4b27c-c70072f9.eln (native compiled elisp)...
Running in GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.43, cairo version 1.18.2)
  of 2024-12-09
is? nil
is? t   ;; expecting nil
bar: 111


[-- Attachment #2: bug.el --]
[-- Type: text/x-emacs-lisp, Size: 409 bytes --]

;;;   -*- lexical-binding: t -*-
;;
;; /opt/emacs/bin/emacs -Q --batch -L . --eval "(load (native-compile \"/tmp/bug.el\"))" -f run

(require 'cl-lib)

(cl-defstruct foobles bar baz)

(defun bug (foo)
  (message "is? %s" (foobles-p foo))
  (message "is? %s" (foobles-p foo))
  (message "bar: %s" (foobles-bar foo)))

(defun run ()
  (message "Running in %s" (version))
  (let ((foo "foo"))
    (bug foo)))




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-12-11 22:29 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-10 16:55 bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) Eric Marsden
2024-12-10 21:21 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-10 22:12 ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 12:32   ` Eli Zaretskii
2024-12-11 14:01     ` Pip Cet via Bug reports for GNU Emacs, the Swiss army knife of text editors
2024-12-11 22:29 ` Andrea Corallo

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).