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


On Thu, 2006-02-09 at 12:54 -0500, Diego Novillo wrote:
> 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'.

You do know d == 0 (because the array size is only one element),  if it
wasn't for the stupid use of malloc tricks on arrays like the above.





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