2013-04-30 Chao-ying Fu <Chao-ying.Fu@imgtec.com>
authorChao-ying Fu <fu@mips.com>
Wed, 1 May 2013 01:02:01 +0000 (01:02 +0000)
committerChao-ying Fu <fu@mips.com>
Wed, 1 May 2013 01:02:01 +0000 (01:02 +0000)
* config/tc-mips.c (mips_ip): Add sizelo.
For "+C", "+G", and "+H", set sizelo and compare against it.

gas/ChangeLog
gas/config/tc-mips.c

index ec756d8fc7e0ed38004850c2fbc03e5c05c55263..f152068871a9a62ebea6c4901fa689eae0643907 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-30  Chao-ying Fu  <Chao-ying.Fu@imgtec.com>
+
+       * config/tc-mips.c (mips_ip): Add sizelo.
+       For "+C", "+G", and "+H", set sizelo and compare against it.
+
 2013-04-29  Nick Clifton  <nickc@redhat.com>
 
        * as.c (Options): Add -gdwarf-sections.
index a9b46e971d94fc57ca48253bf05eb32dde40daa5..29d2c022541591a39a5499dff2f28eb8150a4737 100644 (file)
@@ -10790,6 +10790,7 @@ mips_ip (char *str, struct mips_cl_insn *ip)
   unsigned int destregno = 0;
   unsigned int lastpos = 0;
   unsigned int limlo, limhi;
+  int sizelo;
   char *s_reset;
   offsetT min_range, max_range;
   long opend;
@@ -11374,23 +11375,25 @@ mips_ip (char *str, struct mips_cl_insn *ip)
                case 'C':               /* ext size, becomes MSBD.  */
                  limlo = 1;
                  limhi = 32;
+                 sizelo = 1;
                  goto do_msbd;
                case 'G':
                  limlo = 33;
                  limhi = 64;
+                 sizelo = 33;
                  goto do_msbd;
                case 'H':
                  limlo = 33;
                  limhi = 64;
+                 sizelo = 1;
                  goto do_msbd;
                do_msbd:
                  my_getExpression (&imm_expr, s);
                  check_absolute_expr (ip, &imm_expr);
-                 /* Check for negative input so that small negative numbers
-                    will not succeed incorrectly.  The checks against
-                    (pos+size) transitively check "size" itself,
-                    assuming that "pos" is reasonable.  */
-                 if ((long) imm_expr.X_add_number < 0
+                 /* The checks against (pos+size) don't transitively check
+                    "size" itself, assuming that "pos" is reasonable.
+                    We also need to check the lower bound of "size".  */
+                 if ((long) imm_expr.X_add_number < sizelo
                      || ((unsigned long) imm_expr.X_add_number
                          + lastpos) < limlo
                      || ((unsigned long) imm_expr.X_add_number