On Fri, Nov 20, 2020 at 03:44:01PM -0700, Martin Sebor via Gcc-patches wrote: > > So that likely means you are doing it too early. > > The bounds are added to attribute "arg spec" for each param in > push_parm_decl. I think that's both as early and (except maybe > in function definitions) as late as can be. After that point, > the association between a VLA parameter and its most significant > bound is lost.
If the most significant bound is lost, why don't you save in the attribute early only the most significant bound before it is lost and for the other bounds just refer to the SAVE_EXPRs in the FUNCTION_TYPE's TYPE_ARG_TYPES ARRAY_TYPEs? And for function definitions, even the outermost bounds aren't really lost, the FE for int bar (); int baz (); int foo (int n, int x[bar () + 4][baz () + 2]) { return sizeof (x[0]); } emits all the side-effects, though not sure if it creates a SAVE_EXPR for that. But for the definitions you really want to use the same SAVE_EXPR as the function evaluates. Jakub