Fix various errors uncovered by static analysis

Reported-by: Carlos Montiers <cmontiers@gmail.com>
This commit is contained in:
Thomas Preud'homme 2014-03-08 18:36:02 +08:00
parent ba286136bf
commit fdb3b10d06
4 changed files with 2 additions and 5 deletions

View File

@ -1901,8 +1901,6 @@ void gfunc_call(int nb_args)
for (i = 0; i < nb_args; i++) {
if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
ALWAYS_ASSERT(FALSE);
} else if ((vtop->type.t & VT_BTYPE) == VT_STRUCT) {
ALWAYS_ASSERT(FALSE);
} else {
/* simple type (currently always same size) */
/* XXX: implicit cast ? */

View File

@ -162,7 +162,6 @@ ST_FUNC Sym *sym_push2(Sym **ps, int v, int t, long c)
tcc_error("incompatible types for redefinition of '%s'",
get_tok_str(v, NULL));
}
s = *ps;
s = sym_malloc();
s->asm_label = NULL;
s->v = v;

View File

@ -276,7 +276,7 @@ ST_FUNC char *get_tok_str(int v, CValue *cv)
#ifdef _WIN32
sprintf(p, "%u", (unsigned)cv->ull);
#else
sprintf(p, "%Lu", cv->ull);
sprintf(p, "%llu", cv->ull);
#endif
break;
case TOK_LCHAR:

View File

@ -501,7 +501,7 @@ void load(int r, SValue *sv)
o(0xc0 + REG_VALUE(v) + REG_VALUE(r)*8);
}
} else if (r == TREG_ST0) {
assert((v >= TREG_XMM0) || (v <= TREG_XMM7));
assert((v >= TREG_XMM0) && (v <= TREG_XMM7));
/* gen_cvt_ftof(VT_LDOUBLE); */
/* movsd %xmmN,-0x10(%rsp) */
o(0x110ff2);