gcc lost it's magic analyzer and now complains about uninitialized stuff... <sadface>

This commit is contained in:
Wolfgang (Blub) Bumiller 2012-11-04 11:41:44 +01:00
parent 5ff0013357
commit e143db0cae
4 changed files with 10 additions and 6 deletions

4
ast.c
View file

@ -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 */

4
ir.c
View file

@ -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;

1
ir.h
View file

@ -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;

View file

@ -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;