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 GGC


2007/9/27, Zdenek Dvorak <rakdver@kam.mff.cuni.cz>:
> Hello,
>
> > I have several global variables which are of type rtx. They are used
> > in flow.c ia64.c and final.c. As stated in the internal doc with
> > types. I add GTY(()) marker after the keyword 'extern'. for example:
> >          extern GTY(()) rtx a;
> > these 'extern's are added in regs.h which is included in flow.c ia64.c
> > and final.c
> >
> > However, I init 'a' at ia64_compute_frame which is defined in ia64.c
> > but found 'a' incorrectly collected by ggc_collect. (I watch the
> > memory location which is allocated for a, and found it is collected by
> > GGC.
> >
> > Is there any thing I forget to do ?
>
> you need to add regs.h to GTFILES in Makefile.in.
>
> Zdenek
>
Thanks. I found GCC generate the file gtype-desc.c to handle these
definitions, But how does GCC find the corresponded definition for
'extern GTY(()) rtx a' ? Once I want to define the variable in a new
file or extern this variable in a new header file, it will throw the
error that 'the initializer is not constant' (I think the error is due
to GCC can not correlate the 'extern' and 'definition'). Would you
give more details on this problem, especially if want to define and
extern this variable in new files.


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