This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Deal with variable length arrays ending structures in get_base_and_extent


Richard Guenther wrote:

> Just for convenience.  In the case we asserted on we just get back
> the exp with offset 0, size and maxsize matching the type.  But this
> is an unrelated change and I'll leave that out of this bugfix patch.
> 
OK.

> I want to say that for the following case
> 
> typedef struct { struct { int a[1]; } a[1]; } C;
> int fooC1(C *c, int i, int d)
> { 
>   int j = i+i; 
>   c->a[0].a[0] = j;
>   return c->a[0].a[d]; /* Here we can propagate j */
>
You mean, "we can't", right?  You have no way of knowing if 'd == 0'.

> }
> 
> where we have an outer array constraining the size of the inner array.
> Maybe
> 
> "An array ref with a constant index up in the structure hierarchy
>  will constrain the size of any variable array ref lower in the
>  access hierarchy."
> 
OK, that reads better.

Looks fine then.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]