Re: [RFC 11/14] Invalid code in rtx-traverse.scm

"Jose E. Marchesi via Cgen" <[email protected]> Sun, 20 Aug 2023 10:42:34 +0200
Newsgroups gmane.comp.tools.cgen.devel
Message-ID <[email protected]>
> The Guile compiler pointed out a 3-argument call to cons in
> rtx-traverse.scm.  Presumably this code is never run, but this patch
> replaces it with what I think is the correct form.

This LGTM.

The same snippet is commented out in rtx-eval-with-estate:

;		; Don't eval operands for syntax expressions.
;		(if (eq? (rtx-style rtx-obj) 'SYNTAX)
;		    (apply fn (cons estate (cdr expr)))
;		    (let ((operands
;			   (/rtx-eval-operands rtx-obj expr estate)))
;		      (apply fn (cons estate operands))))

And it is (apply fn (cons estate (cdr expr))) there.

> ---
>  rtl-traverse.scm | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/rtl-traverse.scm b/rtl-traverse.scm
> index de7911a..6023648 100644
> --- a/rtl-traverse.scm
> +++ b/rtl-traverse.scm
> @@ -1757,7 +1757,7 @@
>  	(if (procedure? fn)
>  	    ; Don't traverse operands for syntax expressions.
>  	    (if (eq? (rtx-style rtx-obj) 'SYNTAX)
> -		(apply fn (cons tstate cdr expr))
> +		(apply fn (cons tstate (cdr expr)))
>  		(let ((operands (/rtx-traverse-operands rtx-obj expr tstate appstuff)))
>  		  (apply fn (cons tstate operands))))
>  	    fn)