PowerPC-sysV/eabi, harmonization of section attribute and small data optimization
Geoff Keating
geoffk@geoffk.org
Sun Feb 16 04:59:00 GMT 2003
Thierry Moreau <Thierry.Moreau@Connotech.com> writes:
> - /* We have to be careful here, because it is the referenced address
> - that must be 32k from _SDA_BASE_, not just the symbol. */
> summand = INTVAL (XEXP (sum, 1));
> ! if (summand < 0 || summand > g_switch_value)
> return 0;
>
> sym_ref = XEXP (sum, 0);
> --- 1748,1755 ----
> rtx sum = XEXP (op, 0);
> HOST_WIDE_INT summand;
>
> summand = INTVAL (XEXP (sum, 1));
> ! if (summand < 0)
> return 0;
>
> sym_ref = XEXP (sum, 0);
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.
--
- Geoffrey Keating <geoffk@geoffk.org>
More information about the Gcc-patches
mailing list