DECL_FIELD_CONTEXT woes
Gabriele SVELTO
gabriele.svelto@st.com
Thu Jan 10 16:41:00 GMT 2008
Dave Korn wrote:
> On 10 January 2008 16:12, Gabriele SVELTO wrote:
>
> [snip]
>
>> 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 ...
But it's static so it needs to be initialized once before the function gets
called AFAIK. gcc seems to be creating an artificial function for this task or
at least that's how it looks. I've been working on gcc for only ~3 months so I
might be badly wrong on this one.
>> 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?
Yes, TYPE_READONLY () returns 1 on the new type so I guess it's const. So is it
normal that the two types share the fields so that you can end up with
DECL_FIELD_CONTEXT (TYPE_FIELDS (type)) != type ? Does this always happen when
gcc creates a 'derived' const type from another one? Thanks for the help,
Gabriele
More information about the Gcc
mailing list