Sorry, I found it in gccint, thanks :-)
2007/9/28, 吴曦 <[EMAIL PROTECTED]>: > 2007/9/27, Zdenek Dvorak <[EMAIL PROTECTED]>: > > 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. >