bug-guile
[Top][All Lists]
Advanced

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

[bug #34300] Misplaced tail call optimization [2.0.2+]


From: Ludovic Courtès
Subject: [bug #34300] Misplaced tail call optimization [2.0.2+]
Date: Thu, 15 Sep 2011 21:17:40 +0000
User-agent: Mozilla/5.0 (GNU; rv:1.9.1.7) Gecko/20100107 IceCat/3.6 (like Firefox/3.6)

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/




reply via email to

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