On Fri, May 10, 2013 at 8:27 PM, Carrot Wei <car...@google.com> wrote: > Hi > > In function dw2_output_indirect_constant_1 a new var decl is created. Only > When the variable is not PUBLIC it is allocated static storage. Does anybody > know why the variable is not allocated static storage by marking TREE_STATIC > when it is PUBLIC?
Beacuse TREE_STATIC says whether it gets static or external storage. Not all combinations of TREE_STATIC/TREE_PUBLIC/DECL_EXTERNAL make sense (though you'll see very weird combinations from the C++ frontend which also has DECL_REALLY_EXTERN). > The following patch marks the STATIC flag in all cases. It can pass bootstrap > and regression test on x86-64. > > Any comments? Ok. Thanks, Richard. > thanks > Carrot > > > 2013-05-09 Guozhi Wei <car...@google.com> > > * dwarf2asm.c (dw2_output_indirect_constant_1): Mark new decl STATIC. > > > Index: dwarf2asm.c > =================================================================== > --- dwarf2asm.c (revision 198794) > +++ dwarf2asm.c (working copy) > @@ -906,6 +906,7 @@ > DECL_IGNORED_P (decl) = 1; > DECL_INITIAL (decl) = decl; > TREE_READONLY (decl) = 1; > + TREE_STATIC (decl) = 1; > > if (TREE_PUBLIC (id)) > { > @@ -914,8 +915,6 @@ > if (USE_LINKONCE_INDIRECT) > DECL_VISIBILITY (decl) = VISIBILITY_HIDDEN; > } > - else > - TREE_STATIC (decl) = 1; > > sym_ref = gen_rtx_SYMBOL_REF (Pmode, sym); > assemble_variable (decl, 1, 1, 1);