From 6d65fe853d6a92d806c152e48754b6e3cb215815 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 12 Dec 2001 21:29:04 +0000 Subject: [PATCH] spontaneous temp defs need to have their users incremented when an assignment is part of a sub expression --- tools/qfcc/include/qfcc.h | 1 + tools/qfcc/source/emit.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/tools/qfcc/include/qfcc.h b/tools/qfcc/include/qfcc.h index 14b77efd3..b6f1ef5c5 100644 --- a/tools/qfcc/include/qfcc.h +++ b/tools/qfcc/include/qfcc.h @@ -317,6 +317,7 @@ typedef struct def_s { unsigned removed:1; // already removed from the symbol table unsigned used:1; // unused local detection unsigned absolute:1; // don't relocate (for temps for shorts) + unsigned managed:1; // managed temp string_t file; // source file int line; // source line diff --git a/tools/qfcc/source/emit.c b/tools/qfcc/source/emit.c index fe5a242ea..1529679e6 100644 --- a/tools/qfcc/source/emit.c +++ b/tools/qfcc/source/emit.c @@ -268,6 +268,8 @@ emit_sub_expr (expr_t *e, def_t *dest) } if (e->e.expr.op == '=' || e->e.expr.op == PAS) { d = emit_assign_expr (e->e.expr.op, e); + if (!d->managed) + d->users++; break; } if (e->e.expr.e1->type == ex_block @@ -359,6 +361,7 @@ emit_sub_expr (expr_t *e, def_t *dest) e->e.temp.def = PR_GetTempDef (e->e.temp.type, pr_scope); e->e.temp.def->users = e->e.temp.users; e->e.temp.def->expr = e; + e->e.temp.def->managed = 1; } d = e->e.temp.def; break;