]> de.git.xonotic.org Git - xonotic/gmqcc.git/commitdiff
gcc lost it's magic analyzer and now complains about uninitialized stuff... <sadface>
authorWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 4 Nov 2012 10:41:44 +0000 (11:41 +0100)
committerWolfgang (Blub) Bumiller <blub@speed.at>
Sun, 4 Nov 2012 10:41:44 +0000 (11:41 +0100)
ast.c
ir.c
ir.h
parser.c

diff --git a/ast.c b/ast.c
index 7fb5ec4f4cceaf7cc7e3cff73318658fc26c64a8..9172a81c98eabc003d72d7eacb01d64f04e1f3e2 100644 (file)
--- 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 f277ac506b8e8a3cf8381d851ae20bf1ce96d06a..c792b24184980544f3dabe76f0d404ee55443233 100644 (file)
--- 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 1059c6ed9c1753f5d15f7613b4f4fc6030ae47f4..a7f41d0c79f80da57d137305ef09b81a7b317d4f 100644 (file)
--- 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;
index d3ca471cbf7ee11c0815f3bb4d2c8d9b14102862..96daaa4c08a09cdd083d2f9db99f8dbaea938291 100644 (file)
--- 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;