From b2a5a9023b8fa5ffeb8fb87b533d56daec817895 Mon Sep 17 00:00:00 2001 From: "mostang.com!davidm" Date: Sat, 8 Feb 2003 10:10:59 +0000 Subject: [PATCH] Fix signed/unsigned comparisons. (Logical change 1.45) --- src/_UPT_access_fpreg.c | 4 ++-- src/ia64/Gparser-ia64.c | 7 ++++--- src/ia64/regname-ia64.c | 2 +- src/ia64/regs.h | 6 +++--- tests/ia64-test-stack.c | 4 ++-- 5 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/_UPT_access_fpreg.c b/src/_UPT_access_fpreg.c index f697b5d7..d8729617 100644 --- a/src/_UPT_access_fpreg.c +++ b/src/_UPT_access_fpreg.c @@ -39,7 +39,7 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, errno = 0; if (write) - for (i = 0; i < sizeof (*val) / sizeof (wp[i]); ++i) + for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i) { ptrace (PTRACE_POKEUSER, pid, _UPT_reg_offset[reg] + i * sizeof(wp[i]), wp[i]); @@ -47,7 +47,7 @@ _UPT_access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, return -UNW_EBADREG; } else - for (i = 0; i < sizeof (*val) / sizeof (wp[i]); ++i) + for (i = 0; i < (int) (sizeof (*val) / sizeof (wp[i])); ++i) { wp[i] = ptrace (PTRACE_PEEKUSER, pid, _UPT_reg_offset[reg] + i * sizeof(wp[i]), 0); diff --git a/src/ia64/Gparser-ia64.c b/src/ia64/Gparser-ia64.c index 24473fcf..dd5e71e9 100644 --- a/src/ia64/Gparser-ia64.c +++ b/src/ia64/Gparser-ia64.c @@ -210,7 +210,7 @@ finish_prologue (struct ia64_state_record *sr) /* First, resolve implicit register save locations (see Section "11.4.2.3 Rules for Using Unwind Descriptors", rule 3). */ - for (i = 0; i < NELEMS (unw.save_order); ++i) + for (i = 0; i < (int) NELEMS (unw.save_order); ++i) { reg = sr->curr.reg + unw.save_order[i]; if (reg->where == IA64_WHERE_GR_SAVE) @@ -238,7 +238,7 @@ finish_prologue (struct ia64_state_record *sr) regs[1] = sr->curr.reg + IA64_REG_R4; regs[2] = sr->curr.reg + IA64_REG_B1; - for (t = 0; t < sr->region_len; ++t) + for (t = 0; (int) t < sr->region_len; ++t) { if ((t & 3) == 0) mask = *cp++; @@ -920,7 +920,8 @@ create_state_record_for (struct cursor *c, struct ia64_state_record *sr, { /* No info, return default unwinder (leaf proc, no mem stack, no saved regs), rp in b0, pfs in ar.pfs. */ - dprintf ("unwind.parser: no unwind info for ip=0x%lx\n", (long) ip); + dprintf ("unwind.parser: no unwind info for ip=0x%lx (gp=%lx)\n", + (long) ip, (long) c->pi.gp); sr->curr.reg[IA64_REG_RP].where = IA64_WHERE_BR; sr->curr.reg[IA64_REG_RP].when = -1; sr->curr.reg[IA64_REG_RP].val = 0; diff --git a/src/ia64/regname-ia64.c b/src/ia64/regname-ia64.c index 57aa802e..13ac0e7c 100644 --- a/src/ia64/regname-ia64.c +++ b/src/ia64/regname-ia64.c @@ -116,7 +116,7 @@ static const char *regname[] = const char * unw_regname (unw_regnum_t reg) { - if (reg < NELEMS (regname)) + if (reg < (unw_regnum_t) NELEMS (regname)) return regname[reg]; else return "???"; diff --git a/src/ia64/regs.h b/src/ia64/regs.h index 92b65e2c..c6b8e229 100644 --- a/src/ia64/regs.h +++ b/src/ia64/regs.h @@ -14,13 +14,13 @@ rotate_gr (struct cursor *c, int reg) rrb_gr = (c->cfm >> 18) & 0x7f; if ((unsigned) (reg - 32) > sof) - return reg; /* not a valid stacked register: just return original value */ + return reg; /* not a valid stacked register: just return original value */ else if ((unsigned) (reg - 32) > sor) - preg = reg; /* register not part of the rotating partition */ + preg = reg; /* register not part of the rotating partition */ else { preg = reg + rrb_gr; /* apply rotation */ - if (preg > 32 + sor) + if (preg > 32 + (int) sor) preg -= sor; /* wrap around */ } debug (100, "%s: sor=%u rrb.gr=%u, r%d -> r%d\n", diff --git a/tests/ia64-test-stack.c b/tests/ia64-test-stack.c index 36443f77..2b47f3d4 100644 --- a/tests/ia64-test-stack.c +++ b/tests/ia64-test-stack.c @@ -106,13 +106,13 @@ do_unwind_tests (void) if ((ret = unw_get_reg (&c, UNW_IA64_CFM, &cfm)) < 0) break; sof = cfm & 0x7f; - if (sof != (i & 1)) + if (sof != (unw_word_t) (i & 1)) panic ("\texpected sof=%d, found sof=%lu\n", i - 1, sof); if (sof == 1) { if ((ret = unw_get_reg (&c, UNW_IA64_GR + 32, &r32)) < 0) break; - if (r32 != i - 1) + if (r32 != (unw_word_t) (i - 1)) panic ("\texpected r32=%d, found r32=%lu\n", i - 1, r32); } }