GNU bug report logs - #9769
Misplaced tail call optimization

Previous Next

Package: guile;

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

Date: Sun, 16 Oct 2011 20:30:02 UTC

Severity: normal

Done: Andy Wingo <wingo <at> pobox.com>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 9769 in the body.
You can then email your comments to 9769 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-guile <at> gnu.org:
bug#9769; Package guile. (Sun, 16 Oct 2011 20:30:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to ludo <at> gnu.org (Ludovic Courtès):
New bug report received and forwarded. Copy sent to bug-guile <at> gnu.org. (Sun, 16 Oct 2011 20:30:02 GMT) Full text and rfc822 format available.

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

From: ludo <at> gnu.org (Ludovic Courtès)
To: bug-guile <at> gnu.org
Subject: Misplaced tail call optimization
Date: Sun, 16 Oct 2011 22:29:00 +0200
(This is a copy of <http://savannah.gnu.org/bugs/?34300>, so it doesn't
get lost.  :-))

Consider this example:

  (define bar
    (lambda ()
      (let ((fail (lambda () 'fail)))
        (let loop ((a (iota 3)))
          (if (pair? a)
              (loop (cdr a))
              (fail)))
        (pk 'done))))

This function should return 'done but it instead returns 'fail, because both
the call to `loop' and the call to `fail' are compiled as if they were tail
calls.

To reproduce the test, turn partial evaluation off---otherwise the call to
`fail' is inlined and the problem doesn't show up.

Ludo'.




Information forwarded to bug-guile <at> gnu.org:
bug#9769; Package guile. (Mon, 17 Oct 2011 08:35:02 GMT) Full text and rfc822 format available.

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

From: Andy Wingo <wingo <at> pobox.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 9769 <at> debbugs.gnu.org
Subject: Re: bug#9769: Misplaced tail call optimization
Date: Mon, 17 Oct 2011 10:33:12 +0200
The title of this bug isn't quite right.  It's not that Guile is
intentionally treating the call to fail as a tail call; it's some
bug in the way that "labels allocated" procedures in compile-glil.scm
are called.

Andy
-- 
http://wingolog.org/




Reply sent to Andy Wingo <wingo <at> pobox.com>:
You have taken responsibility. (Thu, 20 Oct 2011 21:53:02 GMT) Full text and rfc822 format available.

Notification sent to ludo <at> gnu.org (Ludovic Courtès):
bug acknowledged by developer. (Thu, 20 Oct 2011 21:53:02 GMT) Full text and rfc822 format available.

Message #13 received at 9769-done <at> debbugs.gnu.org (full text, mbox):

From: Andy Wingo <wingo <at> pobox.com>
To: ludo <at> gnu.org (Ludovic Courtès)
Cc: 9769-done <at> debbugs.gnu.org
Subject: Re: bug#9769: Misplaced tail call optimization
Date: Thu, 20 Oct 2011 23:51:20 +0200
Fixed in git.  Thanks for the report!

commit aa9c19858872a135ea959066fff26f86527a1bd0
Author: Andy Wingo <wingo <at> pobox.com>
Date:   Thu Oct 20 23:50:05 2011 +0200

    fix misallocation of some <fix> procedures
    
    * module/language/tree-il/analyze.scm (analyze-lexicals): When stepping
      into a non-tail form, we know that labels allocation will be invalid,
      so use an empty labels set.  Fixes http://debbugs.gnu.org/9769.
    
    * test-suite/tests/tree-il.test ("labels allocation"): Add a test.

-- 
http://wingolog.org/




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Fri, 18 Nov 2011 12:24:04 GMT) Full text and rfc822 format available.

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

Previous Next


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