From: Michael Eager Date: Thu, 24 Jul 2014 02:21:42 +0000 (-0700) Subject: se typecast 'size_t' on 'reg', not only avoid the related warning, but X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=a52b4d3e268c10b84a48572db632d5011018e3ef;p=binutils-gdb.git se typecast 'size_t' on 'reg', not only avoid the related warning, but also check whether less than zero -- for 'reg' is type 'int', and sizeof (dwarf2_to_reg_map) is less than 0x7fff. It is quoted in gdb_assert(), so need check 'reg' whether less than zero. And the related warning (with '-W'): ../../binutils-gdb/gdb/microblaze-tdep.c:667:3: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare] ChangeLog: * microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Check whether less tha zero in conditional expression. --- diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0b27e2c1bba..f6b97deabab 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,8 @@ +2014-07-23 Chen Gang + + * microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Check whether + less than zero in conditional expression. + 2014-07-23 Tom Tromey * make-target-delegates ($ARGS_PART): Match trailing close paren. diff --git a/gdb/microblaze-tdep.c b/gdb/microblaze-tdep.c index 7e892411366..9bec2602f29 100644 --- a/gdb/microblaze-tdep.c +++ b/gdb/microblaze-tdep.c @@ -664,7 +664,7 @@ static int dwarf2_to_reg_map[78] = static int microblaze_dwarf2_reg_to_regnum (struct gdbarch *gdbarch, int reg) { - gdb_assert (reg < sizeof (dwarf2_to_reg_map)); + gdb_assert ((size_t) reg < sizeof (dwarf2_to_reg_map)); return dwarf2_to_reg_map[reg]; }