comparison lwasm/insn_gen.c @ 283:210d261a614d

Make byte overflow detection for indexing work better There are *two* places where indexed addressing is calculated - lea style instructions and general addressing instructions. Actually check for byte overflows in both places. Also, extend byte overflow checking to all 8 bit offsets from index registers, not just PCR.
author William Astle <lost@l-w.ca>
date Mon, 02 Sep 2013 10:49:57 -0600
parents 67acad9db5b3
children 3afb809c7add
comparison
equal deleted inserted replaced
282:3c421f24c9b8 283:210d261a614d
268 268
269 if (l -> lint2 == 1) 269 if (l -> lint2 == 1)
270 { 270 {
271 lwasm_emit(l, l -> pb); 271 lwasm_emit(l, l -> pb);
272 if (l -> lint > 0) 272 if (l -> lint > 0)
273 {
274 int i;
275 i = lw_expr_intval(e);
276 if (l -> lint == 1)
277 {
278 if (i < -128 || i > 127)
279 lwasm_register_error(as, l, "Byte overflow");
280 }
273 lwasm_emitexpr(l, e, l -> lint); 281 lwasm_emitexpr(l, e, l -> lint);
282 }
274 return; 283 return;
275 } 284 }
276 285
277 if (l -> lint2 == 2) 286 if (l -> lint2 == 2)
278 lwasm_emitexpr(l, e, 2); 287 lwasm_emitexpr(l, e, 2);