Mercurial > hg > index.cgi
diff lwasm/insn_gen.c @ 458:3948c874901b
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.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 17 Feb 2018 00:13:46 -0700 |
parents | b20f14edda5a |
children | 2c1c5dd84024 |
line wrap: on
line diff
--- 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); }