1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-06-10 14:00:21 +02:00

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.
This commit is contained in:
Mark H Weaver 2013-08-03 14:51:07 -04:00
parent cb1482e719
commit 4350c15673

View file

@ -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), \