From d86fff4454536e772ede18a5aaa05ea91e9d31c7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 11 Apr 2011 04:52:01 +0000 Subject: [PATCH] * config/tc-cr16.c (getprocreg_image): Correct range check. (getprocregp_image): Likewise. --- gas/ChangeLog | 5 +++++ gas/config/tc-cr16.c | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 90f8d7f7048..13a107558df 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,8 @@ +2011-04-11 Alan Modra + + * config/tc-cr16.c (getprocreg_image): Correct range check. + (getprocregp_image): Likewise. + 2011-04-06 Joseph Myers * configure.tgt (strongarm*be, strongarm*b, strongarm*, diff --git a/gas/config/tc-cr16.c b/gas/config/tc-cr16.c index a6185f99af8..09e51b3f856 100644 --- a/gas/config/tc-cr16.c +++ b/gas/config/tc-cr16.c @@ -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 @@ -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) -- 2.30.2