# HG changeset patch # User William Astle # Date 1518851626 25200 # Node ID 3948c874901b29bfa5375db50052c9a7405018b7 # Parent 7d6eacd8737079539b73f53b0605de283390c561 Make offset,R operand size warning work properly Make the offset,R operand size check warning work for non-lea operations. Also exclude offset,W from the check since there is no 8 bit offset. diff -r 7d6eacd87370 -r 3948c874901b lwasm/insn_gen.c --- a/lwasm/insn_gen.c Fri Feb 16 23:40:53 2018 -0700 +++ b/lwasm/insn_gen.c Sat Feb 17 00:13:46 2018 -0700 @@ -288,6 +288,17 @@ if (i < -128 || i > 127) lwasm_register_error(as, l, E_BYTE_OVERFLOW); } + else if (l -> lint == 2 && lw_expr_istype(e, lw_expr_type_int) && CURPRAGMA(l, PRAGMA_OPERANDSIZE)) + { + if (l -> pb != 0xAF && l -> pb != 0xB0) + { + if ((i >= -128 && i <= 127) || i >= 0xFF80) + { + lwasm_register_error(as, l, W_OPERAND_SIZE); + + } + } + } lwasm_emitexpr(l, e, l -> lint); } diff -r 7d6eacd87370 -r 3948c874901b lwasm/insn_indexed.c --- a/lwasm/insn_indexed.c Fri Feb 16 23:40:53 2018 -0700 +++ b/lwasm/insn_indexed.c Sat Feb 17 00:13:46 2018 -0700 @@ -709,7 +709,8 @@ } } - if (l -> lint == 2 && CURPRAGMA(l, PRAGMA_OPERANDSIZE)) + // exclude expr,W since that can only be 16 bits + if (l -> lint == 2 && CURPRAGMA(l, PRAGMA_OPERANDSIZE) && (l -> pb != 0xAF && l -> pb != 0xB0)) { int offs; e = lwasm_fetch_expr(l, 0);