* config/tc-cr16.c (getprocreg_image): Correct range check.
authorAlan Modra <amodra@gmail.com>
Mon, 11 Apr 2011 04:52:01 +0000 (04:52 +0000)
committerAlan Modra <amodra@gmail.com>
Mon, 11 Apr 2011 04:52:01 +0000 (04:52 +0000)
(getprocregp_image): Likewise.

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

index 90f8d7f..13a1075 100644 (file)
@@ -1,3 +1,8 @@
+2011-04-11  Alan Modra  <amodra@gmail.com>
+
+       * config/tc-cr16.c (getprocreg_image): Correct range check.
+       (getprocregp_image): Likewise.
+
 2011-04-06  Joseph Myers  <joseph@codesourcery.com>
 
        * configure.tgt (strongarm*be, strongarm*b, strongarm*,
index a6185f9..09e51b3 100644 (file)
@@ -1,5 +1,6 @@
 /* tc-cr16.c -- Assembler code for the CR16 CPU core.
-   Copyright 2007, 2008, 2009 Free Software Foundation, Inc.
+   Copyright 2007, 2008, 2009, 2010, 2011
+   Free Software Foundation, Inc.
 
    Contributed by M R Swami Reddy <MR.Swami.Reddy@nsc.com>
 
@@ -1669,7 +1670,7 @@ getprocreg_image (reg r)
   char *reg_name;
 
   /* Check whether the register is in registers table.  */
-  if (r < MAX_REG)
+  if (r >= MAX_REG && r < MAX_PREG)
     rreg = &cr16_pregtab[r - MAX_REG];
   /* Register not found.  */
   else
@@ -1708,7 +1709,7 @@ getprocregp_image (reg r)
   int pregptab_disp = 0;
 
   /* Check whether the register is in registers table.  */
-  if (r < MAX_REG)
+  if (r >= MAX_REG && r < MAX_PREG)
     {
       r = r - MAX_REG;
       switch (r)