Subject: Wrong file in "autoloading failed to define" error

From: Glenn Morris <[email-masked]>
Date: Mon, 08 May 2017 15:14:44 -0400

Package: emacs
Version: 26.0.50
Severity: minor

cat <<EOF > bar.el
(provide 'bar)
EOF

emacs -Q -L $PWD
(autoload 'bar "bar")
(bar)

 -> (error "Autoloading file /path/to/bar.el failed to define function bar")

which is correct and good.

Now:
C-]   ; exit debugger
(bar) ; repeat

 -> (error "Autoloading file /path/to/help-mode.elc failed to define function bar") 

Ie, the wrong file name is reported after the first time round.

Ref: http://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00668.html