bug-guile
[Top][All Lists]
Advanced

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

bug#21899: let/ec continuations not distinct under compiler


From: Andy Wingo
Subject: bug#21899: let/ec continuations not distinct under compiler
Date: Fri, 24 Jun 2016 18:29:26 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

On Fri 13 Nov 2015 08:57, Zefram <address@hidden> writes:

> With guile 2.0.11:
>
> scheme@(guile-user)> (use-modules (ice-9 control))
> scheme@(guile-user)> (list 'a (let/ec ae (list 'b (let/ec be (be 2)))))
> $1 = (a (b 2))
> scheme@(guile-user)> (list 'a (let/ec ae (list 'b (let/ec be (ae 2)))))
> $2 = (a (b 2))
> scheme@(guile-user)> (list 'a (let/ec ae (list 'b (ae 2))))
> $3 = (a 2)
>
> The middle of these three cases is wrong: it attempts to invoke the outer
> escape continuation, but only goes as far as the target of the inner one,
> which it isn't using.  It therefore produces the same result as the first
> case, which invokes the inner escape continuation.  It ought to behave
> like the third case, which shows that the outer escape continuation can
> be successfully invoked when the unused inner continuation is not present.

This is a compiler bug in 2.0:

scheme@(guile-user)> ,optimize (list 'a (let/ec ae (list 'b (let/ec be (ae 
2)))))
$2 = (list 'a
      (let ((tag (list 'let/ec)))
        (call-with-prompt
          tag
          (lambda ()
            (list 'b
                  (let ((tag-1 tag))  ;; <<<< here is the bug
                    (call-with-prompt
                      tag-1
                      (lambda () (abort-to-prompt tag 2))
                      (lambda (_ . results) (@apply values results))))))
          (lambda (_ . results) (@apply values results)))))

In master:

scheme@(guile-user)> ,optimize (list 'a (let/ec ae (list 'b (let/ec be (ae 
2)))))
$1 = (list 'a
      (let ((tag (list 'let/ec)))
        (call-with-prompt
          tag
          (lambda ()
            (list 'b
                  (let ((tag-1 (list 'let/ec)))
                    (call-with-prompt
                      tag-1
                      (lambda () (apply abort tag 2 '()))
                      (lambda (_ . results) (apply values results))))))
          (lambda (_ . results) (apply values results)))))

Weird stuff!

Andy





reply via email to

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