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: DECL_FIELD_CONTEXT woes


On 10 January 2008 16:12, Gabriele SVELTO wrote:

> int
> main()
> {
>    struct try
>    {
>      FLOAT x, y;
>      unsigned unord : 1;
>      unsigned lt : 1;
>      unsigned le : 1;
>      unsigned gt : 1;
>      unsigned ge : 1;
>      unsigned lg : 1;
>    };
> 
>    static struct try const data[] =
>    {
>      { NAN, NAN, 1, 0, 0, 0, 0, 0 },
>      { 0.0, NAN, 1, 0, 0, 0, 0, 0 },
>      { NAN, 0.0, 1, 0, 0, 0, 0, 0 },
>      { 0.0, 0.0, 0, 0, 1, 0, 1, 0 },
>      { 1.0, 2.0, 0, 1, 1, 0, 0, 1 },
>      { 2.0, 1.0, 0, 0, 0, 1, 1, 1 },
>    };


> A new type still named 'struct try' is used in the COMPONENT_REFs of
> this function but this type has a different TYPE_UID from the 'struct try'
> used in main. Since the original type was local to main this makes sense.

  But the array is local to main as well ...

> However this new type shares the fields with the old one i.e. calling
> DECL_FIELD_CONTEXT () on its fields doesn't yield itself but another type
> (the old one used in main).

  Is this possibly because the new type is not "struct try" but "struct try
const"; it adds the const qualifier and refers back to the original "struct
try" for the fields?

    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....


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