GNU bug report logs - #12883
[2.0.6] CSE bug

Previous Next

Package: guile;

Reported by: ludo <at> gnu.org (Ludovic Courtès)

Date: Wed, 14 Nov 2012 15:28:02 UTC

Severity: normal

Done: ludo <at> gnu.org (Ludovic Courtès)

Bug is archived. No further changes may be made.

Full log


Message #26 received at 12883 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Israelsson Tampe <stefan.itampe <at> gmail.com>
To: Ludovic Courtès <ludo <at> gnu.org>
Cc: 12883 <at> debbugs.gnu.org
Subject: Re: bug#12883: [2.0.6] CSE bug
Date: Mon, 19 Nov 2012 12:33:17 +0100
[Message part 1 (text/plain, inline)]
I will send an updated patch later, but to explain

I'm not the author of this so I need you to follow my analyze or we will
wait for
the author to check this!

The intention of unroll is to scan db to check that a commutative property
for an item going into the function holds for all elements in db up to
h==h* is
found. Now at each symbol db-len* is the length of db when created so
(- db-len db-len*) is the length of all elements in db created after the
symbol name.
now db-len* will in the loop lp be decreasing so this length is increasing
and the base = m
is the position in db where we scan to last time, the fix was to make sure
we scan up to
the db-len* 'index' e.g. niter had to be corrected by the base m. Otherwise
we could scan out of
the length of db* and the error we saw was introduced. Another fix is for
unroll to return #t
if the length is out of the db length but this is probably a bandage, not
the bug, the bug is most probably
fixed by this patch.

Is things more clear now?

Anyway you can add traces to check how the fuction scans db as in my first
mail, that shows how the system
worked and it shows the consistency with the first iteration of the loop
which is unaffected by the fix

/Stefan



On Mon, Nov 19, 2012 at 12:07 AM, Ludovic Courtès <ludo <at> gnu.org> wrote:

> Hi Stefan,
>
> Stefan Israelsson Tampe <stefan.itampe <at> gmail.com> 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’.
>
[Message part 2 (text/html, inline)]

This bug report was last modified 12 years and 268 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.