This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PowerPC-sysV/eabi, harmonization of section attribute and small data optimization
> Date: Sat, 15 Feb 2003 21:23:06 -0800
> From: Richard Henderson <rth@redhat.com>
> Cc: Thierry Moreau <Thierry.Moreau@Connotech.com>, gcc-patches@gcc.gnu.org
> On Sat, Feb 15, 2003 at 08:57:25PM -0800, Geoff Keating wrote:
> > This reintroduces a bug that this code was designed to fix. It is not OK.
> >
> > Code that triggers the bug can look like:
> >
> > static char array[4];
> > t = array[x + 80000]; // valid values of x are -80000 through -79997
> >
> > GCC can internally optimise this into
> >
> > t = (array + 80000)[x];
> >
> > and 'array + 80000' can't be done with a SDA relocation.
>
> Seems like the proper solution here is to reject
>
> (const (plus (symbol_ref "array") (const_int large)))
>
> when array is in the sda, and large puts it out of
> range of the SDA reloc. Bounding large by the max
> size of an SDA object seems reasonable.
Yes, that's what the current code does.
--
- Geoffrey Keating <geoffk@geoffk.org>