From 2de7733b6ab8d3550266352ee22658a41e17b4ae Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Wed, 30 Mar 2011 21:21:38 +0900 Subject: [PATCH] Fix initialized variable type handling. Same problem as initialized constants :P --- tools/qfcc/source/def.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/qfcc/source/def.c b/tools/qfcc/source/def.c index 962a472a5..3755743cc 100644 --- a/tools/qfcc/source/def.c +++ b/tools/qfcc/source/def.c @@ -500,7 +500,10 @@ initialize_def (symbol_t *sym, type_t *type, expr_t *init, defspace_t *space, if (init->e.value.v.pointer.def) reloc_def_field (init->e.value.v.pointer.def, sym->s.def); } else { - memcpy (D_POINTER (void, sym->s.def), &init->e.value.v, + ex_value_t v = init->e.value; + if (is_scalar (sym->type)) + convert_value (&v, sym->type); + memcpy (D_POINTER (void, sym->s.def), &v.v, type_size (type) * sizeof (pr_type_t)); } sym->s.def->initialized = sym->s.def->constant = 1;