On 08/21/2015 03:25 PM, k9119911 wrote: > Hi Mikhail > > Thank you so much. > > It works now and declared in .bss section. > > However, I just wonder why it works. > > Because we need to specify in frontend: > > TREE_PUBLIC(decl) = 1 > > but we do the opposite in middle-end: > > TREE_PUBLIC(decl) = 0 > > Why they are different? It is confusing. That is strange. The comment in tree.h says: /* In a VAR_DECL, FUNCTION_DECL, NAMESPACE_DECL or TYPE_DECL, nonzero means name is to be accessible from outside this translation unit. In an IDENTIFIER_NODE, nonzero means an external declaration accessible from outside this translation unit was previously seen for this name in an inner scope. */ #define TREE_PUBLIC(NODE) ((NODE)->base.public_flag) So, it should not be different. It's enough to set TREE_STATIC(decl) = 1, then you don't necessarily need to set TREE_PUBLIC to make the variable global. > > Thanks > > > > -- > View this message in context: http://gcc.1065356.n5.nabble.com/declare-global-in-gimple-tp1178703p1178812.html > Sent from the gcc - Help mailing list archive at Nabble.com. > -- Regards, Mikhail Maltsev