On Mon, Jun 16, 2014 at 12:39:07PM +0200, Marek Polacek wrote:
> Jason/Joseph, could you please look at the C++/C FE parts?
As mentioned on IRC, you need to differentiate between taking address
and not taking address.
struct S { int a; int b; } s[4], *t;
int *a, *b, *c;
void *d;
int e[4][4];
void
foo ()
{
t = &s[4]; // Should be fine
a = &s[4].a; // Error
b = &s[4].b; // Error
d = &e[4]; // Should be fine
c = &e[4][0]; // Error
}
So, supposedly when e.g. in cp_genericize_r, for ADDR_EXPR <ARRAY_REF>
allow off-by-one, for all other ARRAY_REFs (e.g. those not appearing
inside of ADDR_EXPR, or not directly inside of ADDR_EXPR, e.g. with
COMPONENT_REF or another ARRAY_REF in between) disallow off-by-one.
Jakub