This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix out of bound access on hard_regno_nregs


Graham Stott wrote:
All,

int
true_regnum (rtx x)
{
  ...

  if (GET_CODE (x) == SUBREG)
    {
      int base = true_regnum (SUBREG_REG (x));
      if (base >= 0 && base < FIRST_PSEUDO_REGISTER)
        return base + subreg_regno_offset (REGNO (SUBREG_REG (x)),
                                           GET_MODE (SUBREG_REG (x)),
                                           SUBREG_BYTE (x), GET_MODE (x));
    }
  return -1;
}


On 2nd reading it looks like we do have a bug in true_regnum.


Assume that X is a SUBREG whos reg is a pseudo_register that has been renumbered
then it looks like we should be passing BASE and not REGNO (SUBREG_REG (x)) onto
subreg_regno_offset.


Thoughts?

Looks like you're right. This seems to have been broken by the subreg-byte patches (before that we had "base + SUBREG_WORD (...)").



Bernd



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]