From e143db0caec8f3c61008cff5b1abcf0312666efe Mon Sep 17 00:00:00 2001 From: "Wolfgang (Blub) Bumiller" Date: Sun, 4 Nov 2012 11:41:44 +0100 Subject: [PATCH] gcc lost it's magic analyzer and now complains about uninitialized stuff... --- ast.c | 4 ++-- ir.c | 4 ++-- ir.h | 1 + parser.c | 7 +++++-- 4 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ast.c b/ast.c index 7fb5ec4..9172a81 100644 --- a/ast.c +++ b/ast.c @@ -1408,8 +1408,8 @@ bool ast_ifthen_codegen(ast_ifthen *self, ast_function *func, bool lvalue, ir_va ir_block *cond = func->curblock; ir_block *ontrue; ir_block *onfalse; - ir_block *ontrue_endblock; - ir_block *onfalse_endblock; + ir_block *ontrue_endblock = NULL; + ir_block *onfalse_endblock = NULL; ir_block *merge; /* We don't output any value, thus also don't care about r/lvalue */ diff --git a/ir.c b/ir.c index f277ac5..c792b24 100644 --- a/ir.c +++ b/ir.c @@ -2779,7 +2779,7 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc case TYPE_FLOAT: { if (global->isconst) { - iptr = (int32_t*)&global->constval.vfloat; + iptr = (int32_t*)&global->constval.ivec[0]; ir_value_code_setaddr(global, code_globals_add(*iptr)); } else { ir_value_code_setaddr(global, code_globals_add(0)); @@ -2808,7 +2808,7 @@ static bool ir_builder_gen_global(ir_builder *self, ir_value *global, bool isloc { size_t d; if (global->isconst) { - iptr = (int32_t*)&global->constval.vvec; + iptr = (int32_t*)&global->constval.ivec[0]; ir_value_code_setaddr(global, code_globals_add(iptr[0])); if (global->code.globaladdr < 0) return false; diff --git a/ir.h b/ir.h index 1059c6e..a7f41d0 100644 --- a/ir.h +++ b/ir.h @@ -52,6 +52,7 @@ typedef struct ir_value_s { float vfloat; int vint; vector vvec; + int32_t ivec[3]; char *vstring; struct ir_value_s *vpointer; struct ir_function_s *vfunc; diff --git a/parser.c b/parser.c index d3ca471..96daaa4 100644 --- a/parser.c +++ b/parser.c @@ -451,6 +451,7 @@ MEM_VEC_FUNCTIONS(shunt, sy_elem, ops) static sy_elem syexp(lex_ctx ctx, ast_expression *v) { sy_elem e; e.etype = 0; + e.off = 0; e.out = v; e.block = NULL; e.ctx = ctx; @@ -461,6 +462,7 @@ static sy_elem syexp(lex_ctx ctx, ast_expression *v) { static sy_elem syblock(lex_ctx ctx, ast_block *v) { sy_elem e; e.etype = 0; + e.off = 0; e.out = (ast_expression*)v; e.block = v; e.ctx = ctx; @@ -471,6 +473,7 @@ static sy_elem syblock(lex_ctx ctx, ast_block *v) { static sy_elem syop(lex_ctx ctx, const oper_info *op) { sy_elem e; e.etype = 1 + (op - operators); + e.off = 0; e.out = NULL; e.block = NULL; e.ctx = ctx; @@ -1966,8 +1969,8 @@ static bool parse_function_body(parser_t *parser, ast_value *var) ast_expression *framenum = NULL; ast_expression *nextthink = NULL; /* None of the following have to be deleted */ - ast_expression *fld_think, *fld_nextthink, *fld_frame; - ast_expression *gbl_time, *gbl_self; + ast_expression *fld_think = NULL, *fld_nextthink = NULL, *fld_frame = NULL; + ast_expression *gbl_time = NULL, *gbl_self = NULL; bool has_frame_think; bool retval = true; -- 2.39.2