diff options
author | Damien George <damien.p.george@gmail.com> | 2016-02-15 09:38:02 +0000 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2016-02-15 09:38:02 +0000 |
commit | 9598f36a84e19045e2978ab902e2367dc2fa12d4 (patch) | |
tree | dd8ac6e74492e36b8d1dd9eb8446228fec87040a /py | |
parent | 94e4bd456fa4faf3fceb455c51c2c87d24d34fc6 (diff) | |
download | micropython-9598f36a84e19045e2978ab902e2367dc2fa12d4.tar.gz micropython-9598f36a84e19045e2978ab902e2367dc2fa12d4.zip |
py/emitnative: Add check that RHS of viper store is of integral type.
Diffstat (limited to 'py')
-rw-r--r-- | py/emitnative.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/py/emitnative.c b/py/emitnative.c index a14894fd8d..fc9922c1b0 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -1698,6 +1698,10 @@ STATIC void emit_native_store_subscr(emit_t *emit) { #else emit_pre_pop_reg_flexible(emit, &vtype_value, ®_value, reg_base, reg_index); #endif + if (vtype_value != VTYPE_BOOL && vtype_value != VTYPE_INT && vtype_value != VTYPE_UINT) { + EMIT_NATIVE_VIPER_TYPE_ERROR(emit, + "can't store '%q'", vtype_to_qstr(vtype_value)); + } switch (vtype_base) { case VTYPE_PTR8: { // pointer to 8-bit memory @@ -1784,6 +1788,10 @@ STATIC void emit_native_store_subscr(emit_t *emit) { #else emit_pre_pop_reg_flexible(emit, &vtype_value, ®_value, REG_ARG_1, reg_index); #endif + if (vtype_value != VTYPE_BOOL && vtype_value != VTYPE_INT && vtype_value != VTYPE_UINT) { + EMIT_NATIVE_VIPER_TYPE_ERROR(emit, + "can't store '%q'", vtype_to_qstr(vtype_value)); + } switch (vtype_base) { case VTYPE_PTR8: { // pointer to 8-bit memory |