This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Xtensa: fix for long-standing memory corruption problem
- From: Dale Johannesen <dalej at apple dot com>
- To: Bob Wilson <bwilson at tensilica dot com>
- Cc: Dale Johannesen <dalej at apple dot com>, gcc-patches at gcc dot gnu dot org
- Date: Mon, 3 Feb 2003 12:41:18 -0800
- Subject: Re: Xtensa: fix for long-standing memory corruption problem
On Monday, February 3, 2003, at 12:31 PM, Bob Wilson wrote:
This patch fixes the REG_ALLOC_ORDER array for Xtensa processors to
reference
only hard registers. One of the hard registers was removed a long
time ago
but the allocation order was never completely adjusted for the
removal. The
result is that memory past the end of the global array is corrupted.
This
has been harmless so far on GNU/Linux hosts but appears to be
catastrophic on
Solaris and perhaps other hosts as well. (It depends on what global
variable
is placed following the REG_ALLOC_ORDER array.) Tested and committed
on the
mainline.
IMO this whole design is too fragile. If REG_ALLOC_ORDER is too short,
you
get 0 padding at the end, which typically looks like a duplicate
register 0
and causes reload to break in mysterious ways, but not very often. What
do people think of substituting
int reg_alloc_order[] = REG_ALLOC_ORDER;
and sticking a check that
sizeof(reg_alloc_order)==FIRST_PSEUDO_REGISTER*sizeof(int)
somewhere? What's a good place?