all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Eric Marsden <eric.marsden@risk-engineering.org>
To: 74771@debbugs.gnu.org
Subject: bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD)
Date: Tue, 10 Dec 2024 17:55:46 +0100	[thread overview]
Message-ID: <0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org> (raw)

[-- 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)))




             reply	other threads:[~2024-12-10 16:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-10 16:55 Eric Marsden [this message]
2024-12-10 21:21 ` bug#74771: Native compilation bug with struct predicates when lexical binding enabled (HEAD) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0446a656-1fa2-4160-a8ba-69c060a52589@risk-engineering.org \
    --to=eric.marsden@risk-engineering.org \
    --cc=74771@debbugs.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.