From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Israelsson Tampe Newsgroups: gmane.lisp.guile.bugs Subject: bug#12883: [2.0.6] CSE bug Date: Mon, 19 Nov 2012 12:33:17 +0100 Message-ID: References: <871ufwfbny.fsf@gnu.org> <876257bzte.fsf@gnu.org> <87zk2iltpz.fsf@gnu.org> <87fw46fr33.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bea3518da8ea204ced77b2b X-Trace: ger.gmane.org 1353324851 30688 80.91.229.3 (19 Nov 2012 11:34:11 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 19 Nov 2012 11:34:11 +0000 (UTC) Cc: 12883@debbugs.gnu.org To: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-X-From: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Mon Nov 19 12:34:22 2012 Return-path: Envelope-to: guile-bugs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TaPcH-0008Qk-KH for guile-bugs@m.gmane.org; Mon, 19 Nov 2012 12:34:17 +0100 Original-Received: from localhost ([::1]:50322 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaPc7-00055N-Dj for guile-bugs@m.gmane.org; Mon, 19 Nov 2012 06:34:07 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:55607) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaPc2-00055B-Aa for bug-guile@gnu.org; Mon, 19 Nov 2012 06:34:05 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TaPbz-0007Fm-7M for bug-guile@gnu.org; Mon, 19 Nov 2012 06:34:02 -0500 Original-Received: from debbugs.gnu.org ([140.186.70.43]:44271) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TaPbz-0007Fc-3u for bug-guile@gnu.org; Mon, 19 Nov 2012 06:33:59 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1TaPcz-00027E-OA for bug-guile@gnu.org; Mon, 19 Nov 2012 06:35:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Israelsson Tampe Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-guile@gnu.org Resent-Date: Mon, 19 Nov 2012 11:35:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 12883 X-GNU-PR-Package: guile X-GNU-PR-Keywords: Original-Received: via spool by 12883-submit@debbugs.gnu.org id=B12883.13533248688090 (code B ref 12883); Mon, 19 Nov 2012 11:35:01 +0000 Original-Received: (at 12883) by debbugs.gnu.org; 19 Nov 2012 11:34:28 +0000 Original-Received: from localhost ([127.0.0.1]:54521 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TaPcR-00026R-Hi for submit@debbugs.gnu.org; Mon, 19 Nov 2012 06:34:28 -0500 Original-Received: from mail-qc0-f172.google.com ([209.85.216.172]:54657) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1TaPcN-00026I-UJ for 12883@debbugs.gnu.org; Mon, 19 Nov 2012 06:34:25 -0500 Original-Received: by mail-qc0-f172.google.com with SMTP id b25so3398168qca.3 for <12883@debbugs.gnu.org>; Mon, 19 Nov 2012 03:33:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=HacneiaKhejH8Pe75qOs69OwS1Zaozf1BQM+xtBc28E=; b=to70ha4SKnPSZaKXD84ttzEa8Px6IMzanIXPXEHlsY/zc1OuqYOUxVSVcxGyQnITnw 91Wlyru4011zfw9f6rLuWVeZKlcLeAVaZQx5l8HYISXrYOot+p6+HwsU/B9/DBL/twpK NYiUYWzb4eY9dsXYCXHzaK2u4lsVLrY+OgTuOYC9sPhdHXx42S3/aySJDsTMW3KUjniz HxbfRxhNMH/7ybWpTCebseDBJgs0a58m1ILFoxxpe1lNTdTZkaH5/JHawhra5YViq4aJ chHKWq+LgwTgoHO7ZE4mSEJIuh13P1yFkAtv/WJLhgJECByxswdQW7GgoQw/YQa3ToA3 0S3A== Original-Received: by 10.49.133.195 with SMTP id pe3mr1574568qeb.58.1353324798053; Mon, 19 Nov 2012 03:33:18 -0800 (PST) Original-Received: by 10.49.28.135 with HTTP; Mon, 19 Nov 2012 03:33:17 -0800 (PST) In-Reply-To: <87fw46fr33.fsf@gnu.org> X-Spam-Score: 0.1 (/) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-Spam-Score: 0.1 (/) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-guile@gnu.org List-Id: "Bug reports for GUILE, GNU's Ubiquitous Extension Language" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Original-Sender: bug-guile-bounces+guile-bugs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.lisp.guile.bugs:6581 Archived-At: --047d7bea3518da8ea204ced77b2b Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable 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=3D=3Dh* 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 =3D 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=E8s wrote: > Hi Stefan, > > Stefan Israelsson Tampe 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 (=3D h h*) (tree-il=3D? 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 (=3D h h*) (tree-il=3D? exp* ex= p)) > > + (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=92t fully understand what= =92s > going on here. Could you elaborate? :-) > > Also, it would be great if you could send a =91git format-patch=92 kind o= f > 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=92. > --047d7bea3518da8ea204ced77b2b Content-Type: text/html; charset=windows-1252 Content-Transfer-Encoding: quoted-printable I will send an updated patch later, but to explain

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

The intention of unroll is to scan db to che= ck that a commutative property
for an item going into the function holds for all elements in db up to h=3D= =3Dh* is
found. Now at each symbol db-len* is the length of db when crea= ted so
(- db-len db-len*) is the length of all elements in db created af= ter the symbol name.
now db-len* will in the loop lp be decreasing so this length is increasing = and the base =3D 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. nit= er 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 u= nroll to return #t
if the length is out of the db length but this is pro= bably a bandage, not the bug, the bug is most probably
fixed by this pa= tch.

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
wor= ked 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=E8s <ludo@gnu.org>= wrote:
Hi Stefan,

Stefan Israelsson Tampe <stef= an.itampe@gmail.com> skribis:

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

I can confirm it solves the problem, but I don=92t fully understand w= hat=92s
going on here. =A0Could you elaborate? =A0:-)

Also, it would be great if you could send a =91git format-patch=92 kind of<= br> 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, =A0:-)
Ludo=92.

--047d7bea3518da8ea204ced77b2b--