bug-guile
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#9769: Misplaced tail call optimization


From: Ludovic Courtès
Subject: bug#9769: Misplaced tail call optimization
Date: Sun, 16 Oct 2011 22:29:00 +0200
User-agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.90 (gnu/linux)

(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'.





reply via email to

[Prev in Thread] Current Thread [Next in Thread]