This is the mail archive of the gcc@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: Question on building a variably modified type at parameter scope


On Tue, Mar 5, 2013 at 4:49 AM, YU Chenkan <cyuaa@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


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