unofficial mirror of bug-guile@gnu.org 
 help / color / mirror / Atom feed
From: David Kastrup <dak@gnu.org>
To: 13838@debbugs.gnu.org
Cc: David Kastrup <dak@gnu.org>
Subject: bug#13838: [PATCH] Fix duplicate removal of with-fluids
Date: Thu, 28 Feb 2013 10:40:16 +0100	[thread overview]
Message-ID: <1362044416-8464-1-git-send-email-dak@gnu.org> (raw)

The following code displayed #f:

(define a (make-fluid))
(define b (make-fluid))
(with-fluids ((a 3) (a 1) (b 2))
	     (display (fluid-ref b)))

In general, removing any duplicate that is not right at the end of the
(remaining) list will exhibit this problem.  The fluids and vals
arguments are modified in situ; the previous code only modified vals.
---
 libguile/fluids.c |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/libguile/fluids.c b/libguile/fluids.c
index f1c09cb..bd59e26 100644
--- a/libguile/fluids.c
+++ b/libguile/fluids.c
@@ -326,6 +326,8 @@ scm_i_make_with_fluids (size_t n, SCM *fluids, SCM *vals)
           {
             vals[i] = vals[j]; /* later bindings win */
             n--;
+            fluids[j] = fluids[n];
+            vals[j] = vals[n];
             break;
           }
   }
-- 
1.7.10.4






             reply	other threads:[~2013-02-28  9:40 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-28  9:40 David Kastrup [this message]
2013-02-28 11:31 ` bug#13838: [PATCH] Fix duplicate removal of with-fluids Mark H Weaver

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=1362044416-8464-1-git-send-email-dak@gnu.org \
    --to=dak@gnu.org \
    --cc=13838@debbugs.gnu.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).