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

From: Stefan Kangas <[email-masked]>
Date: Sat, 1 Mar 2025 20:21:53 -0800

Andrea Corallo <[email-masked]> writes:

> The attached should be fixing it, could you give it a try?

Ping, Hugh, any chance you could try the below patch?  Thanks.

>
> Circular objects are rare in code and we lived with this for a long
> time, I'd suggest to install this only on master not to touch the
> release branch.  Eli WDYT?
>
> Thanks
>
>   Andrea
>
> diff --git a/lisp/emacs-lisp/comp.el b/lisp/emacs-lisp/comp.el
> index 2966ed255ac..f3b6b8fd606 100644
> --- a/lisp/emacs-lisp/comp.el
> +++ b/lisp/emacs-lisp/comp.el
> @@ -2481,8 +2481,9 @@ comp--ssa-rename-insn
>                   (setf (comp-vec-aref frame slot-n) mvar
>                         (cadr insn) mvar))))
>       (pcase insn
> -       (`(setimm ,(pred targetp) ,_imm)
> -        (new-lvalue))
> +       (`(setimm ,lval ,_imm)
> +        (when (targetp lval)
> +          (new-lvalue)))
>         (`(,(pred comp--assign-op-p) ,(pred targetp) . ,_)
>          (let ((mvar (comp-vec-aref frame slot-n)))
>            (setf (cddr insn) (cl-nsubst-if mvar #'targetp (cddr insn))))