unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: Andy Wingo <wingo@pobox.com>
To: Zefram <zefram@fysh.org>
Cc: 21899@debbugs.gnu.org
Subject: bug#21899: let/ec continuations not distinct under compiler
Date: Fri, 24 Jun 2016 18:48:26 +0200	[thread overview]
Message-ID: <87vb0ycz39.fsf@pobox.com> (raw)
In-Reply-To: <87ziqaczyx.fsf@pobox.com> (Andy Wingo's message of "Fri, 24 Jun 2016 18:29:26 +0200")

On Fri 24 Jun 2016 18:29, Andy Wingo <wingo@pobox.com> writes:

> On Fri 13 Nov 2015 08:57, Zefram <zefram@fysh.org> 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)))))

Narrowed down:

  ,opt (let* ((x (list 'a))
              (y (list 'a)))
         (list x y))
  ;; ->
  (let* ((x (list 'a)) (y x)) (list x y))

It's a bug in 2.0's CSE pass somehow.

Andy





  reply	other threads:[~2016-06-24 16:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-13  7:57 bug#21899: let/ec continuations not distinct under compiler Zefram
2016-06-24 16:29 ` Andy Wingo
2016-06-24 16:48   ` Andy Wingo [this message]
2016-06-24 17:00     ` Zefram
2016-06-24 17:11       ` Zefram
2016-06-24 17:13       ` Andy Wingo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87vb0ycz39.fsf@pobox.com \
    --to=wingo@pobox.com \
    --cc=21899@debbugs.gnu.org \
    --cc=zefram@fysh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).