Mercurial > hg > index.cgi
comparison lwasm/insn_gen.c @ 389:2d9b7ae6c329
Throw error if address overflows in extended mode
This may or may not cause extra problems due to sloppiness in dealing with
calculations that overflow in 16 bits. However, presumably it is a good idea
so unless something major pops up, it seems like a good idea.
Thanks to Erik G <erik@6809.org> for the patch.
author | William Astle <lost@l-w.ca> |
---|---|
date | Mon, 13 Jul 2015 21:37:49 -0600 |
parents | 17fcd0c3ee45 |
children | b20f14edda5a |
comparison
equal
deleted
inserted
replaced
388:f813a56178c0 | 389:2d9b7ae6c329 |
---|---|
109 goto out; | 109 goto out; |
110 | 110 |
111 // if we have a constant now, figure out dp vs nondp | 111 // if we have a constant now, figure out dp vs nondp |
112 if (lw_expr_istype(s, lw_expr_type_int)) | 112 if (lw_expr_istype(s, lw_expr_type_int)) |
113 { | 113 { |
114 if (s -> value > 0xffff) lwasm_register_error(as, l, E_BYTE_OVERFLOW); | |
115 | |
114 v1 = lw_expr_intval(s); | 116 v1 = lw_expr_intval(s); |
115 if (((v1 >> 8) & 0xff) == (l -> dpval & 0xff)) | 117 if (((v1 >> 8) & 0xff) == (l -> dpval & 0xff)) |
116 { | 118 { |
117 l -> lint2 = 0; | 119 l -> lint2 = 0; |
118 goto out; | 120 goto out; |