Am Montag, den 09.08.2021, 15:52 +0200 schrieb Eric Botcazou:
> > I think the patch makes sense but the comment says
> >
> > Java requires that we elaborated nodes in source order. That
> > means we must gimplify the inner expression followed by each
> > of
> > the indices, in order. But we can't gimplify the inner
> > expression until we deal with any variable bounds, sizes, or
> > positions in order to deal with PLACEHOLDER_EXPRs.
> >
> > and I don't really understand that (not to say Java is no longer
> > supported
> > by GCC, but Ada does use PLACEHOLDER_EXPRs). In fact the comment
> > suggests that we _should_ gimplify the inner expression first ...
> > at least
> > it seems to after your explanations ;)
>
> We already gimplify the inner expression first, i.e. before indices
> and operands, but we gimplify the "annotations" (special operands)
> before.
>
> > Eric - do you know anything about this?
>
> If the comment is right, then Martin's patch should break Ada indeed.
>
Yes, it breaks Ada. I already found this out
in the meanwhile.
But I do not understand how this works with the
PLACEHOLDER_EXPR.
My understanding of this is that this is for referring
to some field of an outer struct which is then used in the
size expression, e.g. something like this (using
C syntax):
struct foo {
int len;
float (*x)[3][len];
};
And then for
struct foo* p;
p->x[1][1];
we use the field 'len' of the struct pointed to by 'p'
the size expression.
But then why would you gimplify the size expression before
the base expression? I would assume that you also want
to process the base expression first, because it is the
source of the struct which we access in the size expression.
Best,
Martin