summaryrefslogtreecommitdiffstatshomepage
path: root/py/vm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-05-31 17:59:11 +0100
committerDamien George <damien.p.george@gmail.com>2014-05-31 17:59:11 +0100
commit5b5562c1d13fa0b78fd13731cebdaa911eb47726 (patch)
tree3b5b698e0c48b49cd1e896fc8dee262b952f9296 /py/vm.c
parent049a01d148c757a17e9804a2b1e42c918e29b094 (diff)
downloadmicropython-5b5562c1d13fa0b78fd13731cebdaa911eb47726.tar.gz
micropython-5b5562c1d13fa0b78fd13731cebdaa911eb47726.zip
py: Fix stack underflow with optimised for loop.
Diffstat (limited to 'py/vm.c')
-rw-r--r--py/vm.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/py/vm.c b/py/vm.c
index aa7e0e2cfc..75093d2401 100644
--- a/py/vm.c
+++ b/py/vm.c
@@ -159,8 +159,8 @@ mp_vm_return_kind_t mp_execute_bytecode(const byte *code, const mp_obj_t *args,
#if DETECT_VM_STACK_OVERFLOW
if (vm_return_kind == MP_VM_RETURN_NORMAL) {
- if (sp != state) {
- printf("Stack misalign: %d\n", sp - state);
+ if (sp < state) {
+ printf("VM stack underflow: " INT_FMT "\n", sp - state);
assert(0);
}
}
@@ -178,7 +178,7 @@ mp_vm_return_kind_t mp_execute_bytecode(const byte *code, const mp_obj_t *args,
}
}
if (overflow) {
- printf("VM stack overflow state=%p n_state+1=%u\n", state, n_state);
+ printf("VM stack overflow state=%p n_state+1=" UINT_FMT "\n", state, n_state);
assert(0);
}
}