On Tue, Mar 5, 2013 at 4:49 AM, YU Chenkan <cy...@ust.hk> wrote: > > I'm a newbie and I'm trying to modify the front end to extend C. > > I know the following code can be accepted, > > void f (struct S { int a; } s, int a[][s.a]) { } . > > I'm wondering whether it is possible to build a structure which has a > variably modified array whose size depends on an other field in that > structure at parameter scopes, > i.e, something like this, > > void f (struct S { int a; int b[s.a]; } s) { } . > > This won't be compiled as s is not declared when build the struct S, but > by modifying the front end code, I can mimic this directly. However, the > assertion, > > gcc_assert (SA.partition_to_pseudo[i]); > > in the function gimple_expend_cfg in cfgexpand.c fails, and I've no idea > why.
I believe this should be possible. I believe that Ada has constructs like this. I think you will need to use a PLACEHOLDER_EXPR to get the right thing to happen. Ian