se typecast 'size_t' on 'reg', not only avoid the related warning, but
authorMichael Eager <eager@eagercon.com>
Thu, 24 Jul 2014 02:21:42 +0000 (19:21 -0700)
committerMichael Eager <eager@eagercon.com>
Thu, 24 Jul 2014 02:21:42 +0000 (19:21 -0700)
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.

gdb/ChangeLog
gdb/microblaze-tdep.c

index 0b27e2c1bba4ab88adffe09d7e40ed6d6a87d4a3..f6b97deabab5bd552bb8b00f971d7ec4c7d7bae4 100644 (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.
index 7e8924113669a6ccca7245011f1dc81cc8921a64..9bec2602f2962963cf7275a8739da636f3655ca2 100644 (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];
 }