diff --git a/tools/qfcc/source/immediate.c b/tools/qfcc/source/immediate.c
index a479ceebb..93c8db928 100644
--- a/tools/qfcc/source/immediate.c
+++ b/tools/qfcc/source/immediate.c
@@ -238,6 +238,7 @@ ReuseConstant (expr_t *expr, def_t *def)
 			def->ofs = cn->ofs;
 			def->initialized = def->constant = 1;
 			def->nosave = 1;
+			def->local = 0;
 			cn = def;
 		} else {
 			if (cn->type != type) {
diff --git a/tools/qfcc/source/qfcc.c b/tools/qfcc/source/qfcc.c
index e520eaed1..125ef7e4d 100644
--- a/tools/qfcc/source/qfcc.c
+++ b/tools/qfcc/source/qfcc.c
@@ -468,6 +468,8 @@ finish_compilation (void)
 			num_localdefs += f->scope->space->size;
 		}
 		for (def = f->scope->head; def; def = def->def_next) {
+			if (!def->local)
+				continue;
 			def->ofs += df->parm_start;
 			relocate_refs (def->refs, def->ofs);
 		}