diff --git a/tccgen.c b/tccgen.c index 9c12c92..b4f97f4 100644 --- a/tccgen.c +++ b/tccgen.c @@ -329,6 +329,7 @@ static void vsetc(CType *type, int r, CValue *vc) void vpush(CType *type) { CValue cval; + memset(&cval, 0, sizeof(CValue)); vsetc(type, VT_CONST, &cval); } @@ -336,6 +337,7 @@ void vpush(CType *type) ST_FUNC void vpushi(int v) { CValue cval; + memset(&cval, 0, sizeof(CValue)); cval.i = v; vsetc(&int_type, VT_CONST, &cval); } @@ -344,6 +346,7 @@ ST_FUNC void vpushi(int v) static void vpushs(long long v) { CValue cval; + memset(&cval, 0, sizeof(CValue)); if (PTR_SIZE == 4) cval.i = (int)v; else @@ -354,8 +357,9 @@ static void vpushs(long long v) /* push arbitrary 64bit constant */ void vpush64(int ty, unsigned long long v) { - CValue cval; CType ctype; + CValue cval; + memset(&cval, 0, sizeof(CValue)); ctype.t = ty; ctype.ref = NULL; cval.ull = v; @@ -372,6 +376,7 @@ static inline void vpushll(long long v) static inline void vpushsym(CType *type, Sym *sym) { CValue cval; + memset(&cval, 0, sizeof(CValue)); cval.ull = 0; vsetc(type, VT_CONST | VT_SYM, &cval); @@ -446,6 +451,7 @@ ST_FUNC void vpush_global_sym(CType *type, int v) ST_FUNC void vset(CType *type, int r, int v) { CValue cval; + memset(&cval, 0, sizeof(CValue)); cval.i = v; vsetc(type, r, &cval); @@ -731,6 +737,7 @@ ST_FUNC int gv(int rc) unsigned long offset; #if defined(TCC_TARGET_ARM) && !defined(TCC_ARM_VFP) CValue check; + memset(&check, 0, sizeof(CValue)); #endif /* XXX: unify with initializers handling ? */ diff --git a/tccpp.c b/tccpp.c index cf1fc65..2609ad7 100644 --- a/tccpp.c +++ b/tccpp.c @@ -936,6 +936,7 @@ static void tok_str_add2(TokenString *s, int t, CValue *cv) ST_FUNC void tok_str_add_tok(TokenString *s) { CValue cval; + memset(&cval, 0, sizeof(CValue)); /* save line number info */ if (file->line_num != s->last_line_num) { @@ -999,8 +1000,9 @@ static inline void TOK_GET(int *t, const int **pp, CValue *cv) static int macro_is_equal(const int *a, const int *b) { char buf[STRING_MAX_SIZE + 1]; - CValue cv; int t; + CValue cv; + memset(&cv, 0, sizeof(CValue)); while (*a && *b) { TOK_GET(&t, &a, &cv); pstrcpy(buf, sizeof buf, get_tok_str(t, &cv)); @@ -1159,6 +1161,7 @@ static void tok_print(int *str) { int t; CValue cval; + memset(&cval, 0, sizeof(CValue)); printf("<"); while (1) { @@ -2525,9 +2528,10 @@ static int *macro_arg_subst(Sym **nested_list, const int *macro_str, Sym *args) int last_tok, t, spc; const int *st; Sym *s; - CValue cval; TokenString str; CString cstr; + CValue cval; + memset(&cval, 0, sizeof(CValue)); tok_str_new(&str); last_tok = 0; @@ -2629,9 +2633,10 @@ static int macro_subst_tok(TokenString *tok_str, const int *p; TokenString str; char *cstrval; - CValue cval; CString cstr; char buf[32]; + CValue cval; + memset(&cval, 0, sizeof(CValue)); /* if symbol is a macro, prepare substitution */ /* special macros */ @@ -2806,6 +2811,7 @@ static inline int *macro_twosharps(const int *macro_str) /* we search the first '##' */ for(ptr = macro_str;;) { CValue cval; + memset(&cval, 0, sizeof(CValue)); TOK_GET(&t, &ptr, &cval); if (t == TOK_TWOSHARPS) break; @@ -2836,6 +2842,7 @@ static inline int *macro_twosharps(const int *macro_str) t = *++ptr; if (t && t != TOK_TWOSHARPS) { CValue cval; + memset(&cval, 0, sizeof(CValue)); TOK_GET(&t, &ptr, &cval); /* We concatenate the two tokens */ cstr_new(&cstr); @@ -2877,9 +2884,10 @@ static void macro_subst(TokenString *tok_str, Sym **nested_list, int *macro_str1; const int *ptr; int t, ret, spc; - CValue cval; struct macro_level ml; int force_blank; + CValue cval; + memset(&cval, 0, sizeof(CValue)); /* first scan for '##' operator handling */ ptr = macro_str;