URL:
<http://savannah.gnu.org/bugs/?34300>
Summary: Misplaced tail call optimization [2.0.2+]
Project: Guile
Submitted by: civodul
Submitted on: Thu 15 Sep 2011 09:17:38 PM GMT
Category: None
Severity: 4 - Important
Item Group: None
Status: None
Privacy: Public
Assigned to: None
Open/Closed: Open
Discussion Lock: Any
_______________________________________________________
Details:
Consider this example:
#v+
(define bar
(lambda ()
(let ((fail (lambda () 'fail)))
(let loop ((a (iota 3)))
(if (pair? a)
(loop (cdr a))
(fail)))
(pk 'done))))
#v-
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.
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?34300>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/