From 686937123cc228e1a4910bc196d67e444ac1aeeb Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 21 Nov 2012 09:43:59 +0900 Subject: [PATCH] Ensure flowvars always point to the var itself. Pointing to aliases of the var causes all sorts of problems, but this time it was causing the uninitialized variable detector to miss certain parameters. --- tools/qfcc/source/flow.c | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/tools/qfcc/source/flow.c b/tools/qfcc/source/flow.c index b8f786b42..46e70d30d 100644 --- a/tools/qfcc/source/flow.c +++ b/tools/qfcc/source/flow.c @@ -222,24 +222,21 @@ flowvar_is_param (flowvar_t *var) flowvar_t * flow_get_var (operand_t *op) { - operand_t *o; - if (!op) return 0; - o = op; - while (o->op_type == op_alias) - o = o->o.alias; + while (op->op_type == op_alias) + op = op->o.alias; - if (o->op_type == op_temp) { - if (!o->o.tempop.flowvar) - o->o.tempop.flowvar = new_flowvar (); - return o->o.tempop.flowvar; + if (op->op_type == op_temp) { + if (!op->o.tempop.flowvar) + op->o.tempop.flowvar = new_flowvar (); + return op->o.tempop.flowvar; } - if (o->op_type == op_symbol && o->o.symbol->sy_type == sy_var) { - if (!o->o.symbol->flowvar) - o->o.symbol->flowvar = new_flowvar (); - return o->o.symbol->flowvar; + if (op->op_type == op_symbol && op->o.symbol->sy_type == sy_var) { + if (!op->o.symbol->flowvar) + op->o.symbol->flowvar = new_flowvar (); + return op->o.symbol->flowvar; } //FIXME functions? (some are variable) values? return 0; @@ -280,6 +277,8 @@ add_operand (function_t *func, operand_t *op) if (!op) return; + while (op->op_type == op_alias) + op = op->o.alias; if (op->op_type == op_label) return;