This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix out of bound access on hard_regno_nregs
- From: James E Wilson <wilson at specifixinc dot com>
- To: Martin Koegler <mkoegler at auto dot tuwien dot ac dot at>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Thu, 28 Apr 2005 13:33:37 -0700
- Subject: Re: [PATCH] fix out of bound access on hard_regno_nregs
- References: <20041219161904.GA18243@ahab.auto.tuwien.ac.at>
Martin Koegler wrote:
- if (val.start < 0)
+ if (val.start < 0 || val.start >= FIRST_PSEUDO_REGISTER)
I've tested the patch on a ppc-darwin machine, with a bootstrap and make
check. There were no regressions. I got a lot of linker warnings for
the C++ tests which caused a lot of failures with and without the patch,
but there were no apparent real problems, and java worked OK, so I think
this was a good enough test, especially for such a simple patch.
For the record, the patch I checked in is attached.
--
Jim Wilson, GNU Tools Support, http://www.SpecifixInc.com
2005-04-28 Martin Koegler <mkoegler@auto.tuwien.ac.at>
PR rtl-optimization/18877
* reload.c (decompose) <case REG, case SUBREG>: Handle pseudo reg
number in val.start.
Index: reload.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/reload.c,v
retrieving revision 1.261
diff -u -r1.261 reload.c
--- reload.c 15 Dec 2004 20:22:26 -0000 1.261
+++ reload.c 19 Dec 2004 15:56:18 -0000
@@ -2371,7 +2371,7 @@
case REG:
val.reg_flag = 1;
val.start = true_regnum (x);
- if (val.start < 0)
+ if (val.start < 0 || val.start >= FIRST_PSEUDO_REGISTER)
{
/* A pseudo with no hard reg. */
val.start = REGNO (x);
@@ -2388,7 +2388,7 @@
return decompose (SUBREG_REG (x));
val.reg_flag = 1;
val.start = true_regnum (x);
- if (val.start < 0)
+ if (val.start < 0 || val.start >= FIRST_PSEUDO_REGISTER)
return decompose (SUBREG_REG (x));
else
/* A hard reg. */