Mercurial > hg > index.cgi
comparison lwasm/insn_indexed.c @ 282:3c421f24c9b8
Make <...,PCR complain on byte overflows
Richard Goedeken <Richard@fascinationsoftawre.com> reported that forcing 8
bit offsets relative to PCR would not complain if the magnitude of the
offset did not fit in 8 bits. This was the result of a missing test for the
byte overflow situation which has now been added.
author | William Astle <lost@l-w.ca> |
---|---|
date | Sat, 31 Aug 2013 11:46:00 -0600 |
parents | 65510f1574e4 |
children | 210d261a614d |
comparison
equal
deleted
inserted
replaced
281:cb24ffb23f7c | 282:3c421f24c9b8 |
---|---|
579 | 579 |
580 void insn_emit_indexed_aux(asmstate_t *as, line_t *l) | 580 void insn_emit_indexed_aux(asmstate_t *as, line_t *l) |
581 { | 581 { |
582 lw_expr_t e; | 582 lw_expr_t e; |
583 | 583 |
584 if (l -> lint == 1 && (l -> pb == 0x9c || l -> pb == 0x8c)) | |
585 { | |
586 int i; | |
587 e = lwasm_fetch_expr(l, 0); | |
588 i = lw_expr_intval(e); | |
589 if (i < -128 || i > 127) | |
590 { | |
591 lwasm_register_error(as, l, "Byte overflow"); | |
592 } | |
593 } | |
594 | |
584 lwasm_emitop(l, instab[l -> insn].ops[0]); | 595 lwasm_emitop(l, instab[l -> insn].ops[0]); |
585 lwasm_emitop(l, l -> pb); | 596 lwasm_emitop(l, l -> pb); |
586 if (l -> lint > 0) | 597 if (l -> lint > 0) |
587 { | 598 { |
588 e = lwasm_fetch_expr(l, 0); | 599 e = lwasm_fetch_expr(l, 0); |