summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2010-09-10 22:46:42 +0200
committerJose Antonio Ortega Ruiz <jao@gnu.org>2010-09-10 22:46:42 +0200
commit7e5ea91374a8481956082e9d1b98dc9f35931822 (patch)
tree5dda921d4acae89b71ad6009c294d8d17f6b648a /mixlib
parentb4fbf3152a2b2177cdae0dd78f1463dd608d431d (diff)
downloadmdk-7e5ea91374a8481956082e9d1b98dc9f35931822.tar.gz
mdk-7e5ea91374a8481956082e9d1b98dc9f35931822.tar.bz2
Fix for #31010 (no error on MOVE 0)
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/xmix_vm.c24
1 files changed, 14 insertions, 10 deletions
diff --git a/mixlib/xmix_vm.c b/mixlib/xmix_vm.c
index d4b2087..b9c743b 100644
--- a/mixlib/xmix_vm.c
+++ b/mixlib/xmix_vm.c
@@ -1,7 +1,7 @@
/* ---------------------- xmix_vm.c :
* Implementation of the functions declared in xmix_vm.h
* ------------------------------------------------------------------
- * Copyright (C) 2000, 2003, 2004, 2007 Free Software Foundation, Inc.
+ * Copyright (C) 2000, 2003, 2004, 2007, 2010 Free Software Foundation, Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -199,24 +199,28 @@ sla_handler_ (mix_vm_t *vm, const mix_ins_t *ins)
static gboolean
mov_handler_ (mix_vm_t *vm, const mix_ins_t *ins)
{
- mix_short_t from = get_M_ (vm,ins),
- to = mix_word_to_short_fast (get_rI_ (vm,1));
+ mix_short_t from = get_M_ (vm,ins);
+ mix_short_t to = mix_word_to_short_fast (get_rI_ (vm,1));
guint k, delta = ins->fspec;
g_assert (ins->opcode == mix_opMOVE);
- if (mix_short_is_positive (from)
- && mix_short_is_positive (to)
- && MEMOK_ (from + delta -1)
- && MEMOK_ (to + delta - 1))
+
+ gboolean result = (delta == 0)
+ || (mix_short_is_positive (from)
+ && mix_short_is_positive (to)
+ && MEMOK_ (from + delta -1)
+ && MEMOK_ (to + delta - 1));
+
+ if (result && delta > 0)
{
for (k = 0; k < delta; ++k)
set_cell_ (vm, to+k, get_cell_ (vm, from+k));
set_rI_ (vm, 1, to+delta);
- inc_loc_ (vm);
return TRUE;
}
- else
- return FALSE;
+
+ if (result) inc_loc_ (vm);
+ return result;
}
static gboolean