Am Montag, den 09.08.2021, 21:42 +0000 schrieb Joseph Myers:
> On Mon, 9 Aug 2021, Uecker, Martin wrote:
>
> > Evaluate arguments of sizeof that are structs of variable size.
> >
> > Evaluate arguments of sizeof for all types of variable size
> > and not just for VLAs. This fixes some issues related to
> > [PR29970] where statement expressions need to be evaluated
> > so that the size is well defined.
>
> OK. It might be a good idea to check if something like this is also
> needed in c_expr_sizeof_type, since that's also using c_vla_type_p at
> present.
I am still trying to figure out what the branch guarded
by c_vla_type_p is for in c_expr_sizeof_type. The comment
talks about [*], but how would you apply sizeof to
such an array? One can form something like
int foo(int (*x)[*], int a[sizeof *x]);
but only in prototypes and then it is never evaluated.
I guess it is to avoid this being folded to:
int foo(int (*x)[*], int a[0]);
So the question is whether this can also happen with
struct types. This seems possible:
int foo(struct { int z[*]; } v, int (*y)[sizeof v]);
So maybe we need the change there too.
Martin