fix for (apply values '(1))
authorAndy Wingo <wingo@pobox.com>
Sat, 1 Nov 2008 17:37:48 +0000 (18:37 +0100)
committerAndy Wingo <wingo@pobox.com>
Sat, 1 Nov 2008 17:37:48 +0000 (18:37 +0100)
* libguile/vm-i-system.c (return/values): In the
  multiple-values-to-a-single-value-continuation (or MV but where N=1),
  null out the correct number of values from the stack. Fixes aborts on
  (apply values '(1)).

* testsuite/t-values.scm (call-with-values): Add a test.

libguile/vm-i-system.c
testsuite/t-values.scm

index 313a577..39dcb9d 100644 (file)
@@ -1069,7 +1069,7 @@ VM_DEFINE_INSTRUCTION (return_values, "return/values", 1, -1, -1)
       *++sp = stack_base[1];
              
       /* Finally set new stack_base */
-      NULLSTACK (stack_base - sp);
+      NULLSTACK (stack_base - sp + nvalues + 1);
       stack_base = SCM_FRAME_UPPER_ADDRESS (fp) - 1;
     }
   else
index 565f64e..f4c0516 100644 (file)
@@ -5,5 +5,9 @@
       ;; the start-stack forces a bounce through the interpreter
       (call-with-values
           (lambda () (start-stack 'foo (values 1 2)))
+        list)
+
+      (call-with-values
+          (lambda () (apply values '(1)))
         list))