unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
* bug#9769: Misplaced tail call optimization
@ 2011-10-16 20:29 Ludovic Courtès
  2011-10-17  8:33 ` Andy Wingo
  2011-10-20 21:51 ` Andy Wingo
  0 siblings, 2 replies; 3+ messages in thread
From: Ludovic Courtès @ 2011-10-16 20:29 UTC (permalink / raw)
  To: 9769

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





^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-20 21:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-16 20:29 bug#9769: Misplaced tail call optimization Ludovic Courtès
2011-10-17  8:33 ` Andy Wingo
2011-10-20 21:51 ` Andy Wingo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).