Subject: Re: bug#75135: 30.0.93; Infinite loop in comp--native-compile

From: Andrea Corallo <[email-masked]>
Date: Sun, 29 Dec 2024 05:17:10 -0500

Hugh Daschbach <[email-masked]> writes:

> Emacs hangs when attempting to compile tests from obsolete ELPA package
> seq.
>
> To reproduce:
>
> ```
>  curl -o /tmp/seq-tests.el https://git.savannah.gnu.org/cgit/emacs/elpa.git/plain/tests/seq-tests.el?h=externals/seq
> $ emacs -Q --eval "(progn (setq debug-on-quit t) (require 'comp) (comp--native-compile \"/tmp/seq-tests.el\" nil))"
> ```
>
> Press C-g shortly after the Emacs frame opens.  This produces the
> following backtrace:

Okay I can reproduce on master as well.

> ```
> Debugger entered--Lisp error: (quit)
>   #f(compiled-function (x) #<bytecode -0x145e3142cf39a7e4>)(1)
>   cl--nsublis-rec((1 . #1))
>   cl--nsublis-rec((#s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705172435 :slot 0) (1 . #3)))
>   cl--nsublis-rec(((#s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705172435 :slot 0) (1 . #4))))
>   cl-nsublis(((nil . #s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705043564 :slot 1))) (#s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705172435 :slot 0) (1 . #4)) :if #f(compiled-function (x) #<bytecode -0x145e3142cf39a7e4>))
>   cl-nsubst-if(#s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705043564 :slot 1) #f(compiled-function (x) #<bytecode -0x145e3142cf39a7e4>) (#s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705172435 :slot 0) (1 . #5)))
>   comp--ssa-rename-insn((setimm #s(comp-mvar :typeset (t) :valset nil :range nil :neg nil :id 34397705172435 :slot 0) (1 . #4)) #s(comp-vec :data #<hash-table eql 5/6 0x1f48d6ffbc9c ...> :beg 0 :end 5))

[...]

>   comp--ssa()
>   comp--fwprop(nil)
>   comp--native-compile("/tmp/seq-tests.el" nil)
>   (progn (setq debug-on-quit t) (require 'comp) (comp--native-compile "/tmp/seq-tests.el" nil))
>   eval((progn (setq debug-on-quit t) (require 'comp) (comp--native-compile "/tmp/seq-tests.el" nil)) t)
>   command-line-1(("--eval" "(progn (setq debug-on-quit t) (require 'comp) (comp--native-compile \"/tmp/seq-tests.el\" nil))"))
>   command-line()
>   normal-top-level()
> ```
>
> Admittedly, trying to compile an obsolete ELPA package is not a good
> idea.  In fact, it was a configuration bug.  But it might be interesting
> to see why the compiler hangs.

Yes it's certanly interesting thanks for the report will look at.

  Andrea