Subject: Re: bug#54079: 29.0.50; Method dispatching eratically fails

From: Alan Mackenzie <[email-masked]>
Date: Tue, 8 Mar 2022 19:28:27 +0000

Hello, Michael.

On Sun, Mar 06, 2022 at 03:19:02 +0100, Michael Heerdegen wrote:
> Alan Mackenzie <[email-masked]> writes:

> > > > (byte-compile-file
> > > >  "/home/micha/software/emacs/lisp/emacs-lisp/cl-generic.el")
> > > > (require 'gnus-search)

> > Would you try out the following patch, please, which I believe fixes the
> > bug.
> > [...patch...]

> That fixed the above case - but unfortunately not the failing method
> dispatching for my register stuff after compiling some unrelated random
> files.

Sorry for not making more substantial progress on this bug.

With the patch for bug #54248 in place (the bug you closed), does the
following patch do anything for the current bug?

diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index 9be44a8d5a..fb9f70bd67 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -499,9 +499,10 @@ byte-compile-initial-macro-environment
                                        (byte-compile-new-defuns
                                         byte-compile-new-defuns))
                                    (setf result
-                                         (byte-compile-eval
+                                         (byte-run-strip-symbol-positions
+                                          (byte-compile-eval
                                            (byte-compile-top-level
-                                            (byte-compile-preprocess form)))))))
+                                            (byte-compile-preprocess form))))))))
                               (list 'quote result))))
     (eval-and-compile . ,(lambda (&rest body)
                            (byte-compile-recurse-toplevel
@@ -512,9 +513,10 @@ byte-compile-initial-macro-environment
                               ;; or byte-compile-file-form.
                               (let* ((print-symbols-bare t) ; Possibly redundant binding.
                                      (expanded
-                                      (macroexpand--all-toplevel
-                                       form
-                                       macroexpand-all-environment)))
+                                      (byte-run-strip-symbol-positions
+                                       (macroexpand--all-toplevel
+                                        form
+                                        macroexpand-all-environment))))
                                 (eval expanded lexical-binding)
                                 expanded)))))
     (with-suppressed-warnings

If not, could you possibly come up with a repeatable recipe for
reproducing the bug?  Or have you done this already?

> Michael.

-- 
Alan Mackenzie (Nuremberg, Germany).