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.
This commit is contained in:
Michael Eager 2014-07-23 19:21:42 -07:00
parent 11961ad805
commit a52b4d3e26
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2014-07-23 Chen Gang <gang.chen.5i5j@gmail.com>
* microblaze-tdep.c (microblaze_dwarf2_reg_to_regnum): Check whether
less than zero in conditional expression.
2014-07-23 Tom Tromey <tromey@redhat.com>
* make-target-delegates ($ARGS_PART): Match trailing close paren.

View File

@ -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];
}