From 4350c15673a49ca1eacee5670b12d72e3272e3f5 Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sat, 3 Aug 2013 14:51:07 -0400 Subject: [PATCH] VM: Avoid overflow in ASM_ADD when the result is most-positive-fixnum. * libguile/vm-i-scheme.c (ASM_ADD): Remove the tag from one of the operands before adding, to avoid overflow when the result is the most positive fixnum. --- libguile/vm-i-scheme.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libguile/vm-i-scheme.c b/libguile/vm-i-scheme.c index d52eec76c..da56860c6 100644 --- a/libguile/vm-i-scheme.c +++ b/libguile/vm-i-scheme.c @@ -248,8 +248,8 @@ VM_DEFINE_FUNCTION (149, ge, "ge?", 2) asm volatile goto ("mov %1, %%rcx; " \ "test %[tag], %%cl; je %l[slow_add]; " \ "test %[tag], %0; je %l[slow_add]; " \ - "add %0, %%rcx; jo %l[slow_add]; " \ "sub %[tag], %%rcx; " \ + "add %0, %%rcx; jo %l[slow_add]; " \ "mov %%rcx, (%[vsp])\n" \ : /* no outputs */ \ : "r" (x), "r" (y), \