Subject: bug#57957: 29.0.50; Native compilation hangs on cyclic lists

From: Lars Ingebrigtsen <[email-masked]>
Date: Tue, 20 Sep 2022 17:33:55 +0200

Lars Tveito <[email-masked]> writes:

> Evaluating the two following forms results in Emacs hanging:
>
> (defun test-cycle ()
>   '#1=(a . #1#))
>
> (native-compile 'test-cycle)

It seems to be inflooping in comp-ssa-rename.  A debug-on-quit backtrace
included below.

I've added Andrea to the CCs; perhaps he has some comments.

Debugger entered--Lisp error: (quit)
  #f(compiled-function (x) #<bytecode -0xadd90b5d8edcf84>)((a . #1))
  cl--nsublis-rec((a . #1))
  cl--nsublis-rec(((a . #2)))
  cl--nsublis-rec((((a . #3))))
  cl-nsublis(((nil . #s(comp-mvar :typeset (t) :valset nil :range nil :
  cl-nsubst-if(#s(comp-mvar :typeset (t) :valset nil :range nil :neg ni
  comp-ssa-rename-insn((setimm #s(comp-mvar :typeset (t) :valset nil :r
  #f(compiled-function (bb in-frame) #<bytecode -0xdf66bba587123ea>)(#s
  #f(compiled-function (bb in-frame) #<bytecode -0xdf66bba587123ea>)(#s
  comp-ssa-rename()
  #<subr F616e6f6e796d6f75732d6c616d626461_anonymous_lambda_112>("F7465
  comp-ssa()
  comp-fwprop(nil)
  funcall(comp-fwprop nil)
  (setq data (funcall pass data))
  (if (memq pass comp-disabled-passes) (progn) (comp-log (format "(%s) 
  (while (progn (setq t0 (current-time)) (consp --cl-var--)) (setq pass
  (let* ((report nil) (t0 nil) (--cl-var-- comp-passes) (pass nil) (--c
...