Subject: Re: bug#12883: [2.0.6] CSE bug

From: [email-masked] (Ludovic Courtès)
Date: Mon, 19 Nov 2012 00:07:12 +0100

Hi Stefan,

Stefan Israelsson Tampe <[email-masked]> skribis:

> --- a/module/language/tree-il/cse.scm
> +++ b/module/language/tree-il/cse.scm
> @@ -324,10 +324,11 @@
>                 (and (< n env-len)
>                      (match (vlist-ref env n)
>                        ((#(exp* name sym db-len*) . h*)
> -                       (and (unroll db m (- db-len db-len*))
> -                            (if (and (= h h*) (tree-il=? exp* exp))
> -                                (make-lexical-ref (tree-il-src exp) name sym)
> -                                (lp (1+ n) (- db-len db-len*))))))))))))
> +                       (let ((niter (- (- db-len db-len*) m)))
> +                         (and (unroll db m niter)
> +                              (if (and (= h h*) (tree-il=? exp* exp))
> +                                  (make-lexical-ref (tree-il-src exp) name sym)
> +                                  (lp (1+ n) (- db-len db-len*)))))))))))))
>  
>    (define (lookup-lexical sym env)
>      (let ((env-len (vlist-length env)))

I can confirm it solves the problem, but I don’t fully understand what’s
going on here.  Could you elaborate?  :-)

Also, it would be great if you could send a ‘git format-patch’ kind of
patch, with the original test case (and possibly others) added to
cse.test, along with the URL of this bug, and a proper ChangeLog-style
commit log.

TIA,  :-)
Ludo’.