From cfa47717c6f2414c4c2295d52169f50523e6fca9 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 13 Nov 2001 23:17:32 +0000 Subject: [PATCH] expr.c: once again, temp def ref counts seem to be correct pr_def.c: reset recycled temp defs --- tools/qfcc/source/expr.c | 4 +++- tools/qfcc/source/pr_def.c | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tools/qfcc/source/expr.c b/tools/qfcc/source/expr.c index 628e7c20c..1779d10a2 100644 --- a/tools/qfcc/source/expr.c +++ b/tools/qfcc/source/expr.c @@ -888,11 +888,13 @@ binary_expr (int op, expr_t *e1, expr_t *e2) if (op == '=' && e1->type == ex_def) PR_DefInitialized (e1->e.def); + if (op == '=') + inc_users (e1); + if (e1->type == ex_block && e1->e.block.is_call && e2->type == ex_block && e2->e.block.is_call && e1->e.block.result) { e = new_temp_def_expr (e1->e.block.result->e.def->type); - inc_users (e); e1 = binary_expr ('=', e, e1); } diff --git a/tools/qfcc/source/pr_def.c b/tools/qfcc/source/pr_def.c index 0e8fdc71a..9c35e1382 100644 --- a/tools/qfcc/source/pr_def.c +++ b/tools/qfcc/source/pr_def.c @@ -252,13 +252,13 @@ PR_GetTempDef (type_t *type, def_t *scope) if (free_temps[size]) { def = free_temps[size]; free_temps[size] = def->next; + memset (def, 0, sizeof (def_t)); def->type = type; } else { def = PR_NewDef (type, 0, scope); def->ofs = *scope->alloc; *scope->alloc += pr_type_size[size]; } - def->users = 0; def->next = temp_scope.next; temp_scope.next = def; return def;