summaryrefslogtreecommitdiffhomepage
path: root/ir/be/beasm.c
diff options
context:
space:
mode:
authorChristoph Mallon <christoph.mallon@gmx.de>2016-01-25 17:59:50 +0100
committerChristoph Mallon <christoph.mallon@gmx.de>2016-01-25 18:02:59 +0100
commit7b4fe6ac1e15143f9f2ab3efd9da8d18299f5368 (patch)
tree75e7a66ad7beefb320ea46c3bd5f43059e6d5237 /ir/be/beasm.c
parent0263ece78fe3ec6f94e610cb1882c339e115d8a8 (diff)
be: Use the correct loop limit when handling early clobbers in be_make_asm().
This resolves and out of bounds access.
Diffstat (limited to 'ir/be/beasm.c')
-rw-r--r--ir/be/beasm.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/ir/be/beasm.c b/ir/be/beasm.c
index 6ffd8db..d9e1520 100644
--- a/ir/be/beasm.c
+++ b/ir/be/beasm.c
@@ -197,7 +197,7 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
struct obstack *const obst = get_irg_obstack(irg);
/* Handle early clobbers. */
- unsigned const n_inputs = get_ASM_n_inputs(node);
+ size_t const orig_n_ins = ARR_LEN(in_reqs);
ir_asm_constraint const *const out_constraints = get_ASM_output_constraints(node);
unsigned const n_out_constraints = get_ASM_n_output_constraints(node);
for (unsigned o = 0; o != n_out_constraints; ++o) {
@@ -207,7 +207,7 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
arch_register_req_t const *const oreq = out_reqs[o];
unsigned different = 0;
- for (unsigned i = 0; i != n_inputs; ++i) {
+ for (unsigned i = 0; i != orig_n_ins; ++i) {
if (in_reqs[i]->cls == oreq->cls)
different |= 1U << i;
}
@@ -234,7 +234,6 @@ ir_node *be_make_asm(ir_node const *const node, ir_node **in, arch_register_req_
* before...
* FIXME: need to do this per register class...
*/
- size_t const orig_n_ins = ARR_LEN(in_reqs);
size_t const orig_n_outs = ARR_LEN(out_reqs);
uint8_t add_pressure[isa_if->n_register_classes];
memset(add_pressure, 0, sizeof(add_pressure));