public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Gabriele SVELTO <gabriele.svelto@st.com>
To: Dave Korn <dave.korn@artimi.com>
Cc: gcc@gcc.gnu.org
Subject: Re: DECL_FIELD_CONTEXT woes
Date: Thu, 10 Jan 2008 16:41:00 -0000	[thread overview]
Message-ID: <47864A7B.6030005@st.com> (raw)
In-Reply-To: <008201c853a4$7c4137d0$2e08a8c0@CAM.ARTIMI.COM>

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

  reply	other threads:[~2008-01-10 16:41 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-10 16:12 Gabriele SVELTO
2008-01-10 16:19 ` Dave Korn
2008-01-10 16:41   ` Gabriele SVELTO [this message]
2008-01-10 17:03     ` Dave Korn
2008-01-10 17:40       ` Gabriele SVELTO
2008-01-10 17:53         ` Tom Tromey
2008-01-11 11:27           ` Gabriele SVELTO

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=47864A7B.6030005@st.com \
    --to=gabriele.svelto@st.com \
    --cc=dave.korn@artimi.com \
    --cc=gcc@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).