summaryrefslogtreecommitdiffhomepage
path: root/mrbgems
diff options
context:
space:
mode:
authorYukihiro "Matz" Matsumoto <[email protected]>2021-12-01 14:33:52 +0900
committerYukihiro "Matz" Matsumoto <[email protected]>2021-12-01 14:33:52 +0900
commitbd88870afb6e1da7000b8c2bdebdac4f85f15310 (patch)
tree16e27e312d5f1d5b6d0c34ed2e7d601cb38531d5 /mrbgems
parent76659a66ae43ae18211b1050fcf724168508c2d8 (diff)
downloadmruby-bd88870afb6e1da7000b8c2bdebdac4f85f15310.tar.gz
mruby-bd88870afb6e1da7000b8c2bdebdac4f85f15310.zip
codegen.c: `ADDI/SUBI` should not be prefixed by `OP_EXT`; fix #5590
As a general principles numeric instructions should not be prefixed by `OP_EXT` instructions since they are not supported by "mruby/c".
Diffstat (limited to 'mrbgems')
-rw-r--r--mrbgems/mruby-compiler/core/codegen.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/mrbgems/mruby-compiler/core/codegen.c b/mrbgems/mruby-compiler/core/codegen.c
index fa7a98921..371b5fef7 100644
--- a/mrbgems/mruby-compiler/core/codegen.c
+++ b/mrbgems/mruby-compiler/core/codegen.c
@@ -778,8 +778,8 @@ gen_addsub(codegen_scope *s, uint8_t op, uint16_t dst)
struct mrb_insn_data data0 = mrb_decode_insn(mrb_prev_pc(s, data.addr));
mrb_int n0;
if (addr_pc(s, data.addr) == s->lastlabel || !get_int_operand(s, &data0, &n0)) {
- /* OP_ADDI/OP_SUBI takes upto 16bits */
- if (n > INT16_MAX || n < INT16_MIN) goto normal;
+ /* OP_ADDI/OP_SUBI takes upto 8bits */
+ if (n > INT8_MAX || n < INT8_MIN) goto normal;
rewind_pc(s);
if (n == 0) return;
if (n > 0) {