From 2b41a37b3c4127d4a7f95d032ef63f9f8b9e5035 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Wed, 13 Oct 2010 21:18:44 +0200 Subject: [PATCH] fix bug in with-fluids in a non-tail position * libguile/vm-i-system.c (VM_DEFINE_INSTRUCTION): Drop the stack items corresponding the the with-fluids object. Thanks very much to Stefan Israelsson Tampe for the fix. --- libguile/vm-i-system.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/libguile/vm-i-system.c b/libguile/vm-i-system.c index 16b74e2b6..62b5e1a9c 100644 --- a/libguile/vm-i-system.c +++ b/libguile/vm-i-system.c @@ -1575,11 +1575,12 @@ VM_DEFINE_INSTRUCTION (89, wind_fluids, "wind-fluids", 1, -1, 0) unsigned n = FETCH (); SCM wf; - if (sp - 2*n < SCM_FRAME_UPPER_ADDRESS (fp)) - goto vm_error_stack_underflow; - SYNC_REGISTER (); - wf = scm_i_make_with_fluids (n, sp + 1 - 2*n, sp + 1 - n); + sp -= 2 * n; + CHECK_UNDERFLOW (); + wf = scm_i_make_with_fluids (n, sp + 1, sp + 1 + n); + NULLSTACK (2 * n); + scm_i_swap_with_fluids (wf, dynstate); scm_i_set_dynwinds (scm_cons (wf, scm_i_dynwinds ())); NEXT;