unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: 64526@debbugs.gnu.org
Cc: Andrea Corallo <acorallo@gnu.org>
Subject: bug#64526: 30.0.50; jit-compilation and multiple function definitions
Date: Fri, 07 Jul 2023 21:41:24 -0400	[thread overview]
Message-ID: <jwv7crbw56j.fsf@iro.umontreal.ca> (raw)

Package: Emacs
Version: 30.0.50


Say you have a file ~/tmp/foo.el:

    ;;  -*- lexical-binding: t; -*-
    (defun sm-foo1 (a) (list a 1))
    (defun sm-foo1 (a) (list a 2))

which you byte-compile into ~/tmp/foo.elc, and then you do:

    emacs -Q -l ~/tmp/foo
    M-: (sm-foo1 'a) RET

you'll usually get `(a 2)` (and that's what we expect).  But if you enable
native compilation and erase the `eln-cache` before trying it out you
may get `(a 1)` because when the `.eln` file is reloaded on top of the
`.elc` definitions, `comp--late-register-subr` will skip the second
definition :-(

I suspect similar problems can occur when the two definitions are placed
in different files (and those files are loaded "at the same time",
i.e. the second file is loaded before the native-compilation of the
first file finishes) since `comp-deferred-pending-h` does not pay
attention to the file names.  :-(


        Stefan






             reply	other threads:[~2023-07-08  1:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-08  1:41 Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-07-10  7:44 ` bug#64526: 30.0.50; jit-compilation and multiple function definitions Andrea Corallo
2023-07-10  9:38   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-07-10 11:52     ` 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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=jwv7crbw56j.fsf@iro.umontreal.ca \
    --to=bug-gnu-emacs@gnu.org \
    --cc=64526@debbugs.gnu.org \
    --cc=acorallo@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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 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).