On Fri, Dec 07, 2012 at 11:39:42AM +0100, Richard Biener wrote:
> > > > --- gcc/varpool.c.jj 2012-11-19 14:41:27.000000000 +0100
> > > > +++ gcc/varpool.c 2012-12-04 17:42:41.228752645 +0100
> > > > @@ -65,7 +65,10 @@ varpool_remove_node (struct varpool_node
> > > > && !DECL_VIRTUAL_P (node->symbol.decl)
> > > > /* dbxout output constant initializers for readonly vars. */
> > > > && (!host_integerp (DECL_INITIAL (node->symbol.decl), 0)
> > > > - || !TREE_READONLY (node->symbol.decl)))
> > > > + || !TREE_READONLY (node->symbol.decl))
> > > > + /* dwarf2out can use most of the initializers. */
> > > > + && write_symbols != DWARF2_DEBUG
> > > > + && write_symbols != VMS_AND_DWARF2_DEBUG)
> > >
> > > Eh, shouldn't we "abstract" this properly? Like with a bool
> > > flag in debug_hooks? Or with a hook? I see now we special-case
> > > dbxout and dwarf2out ... (can all dwarf versions express the
> > > initializers?)
> >
> > Debug hook for this sounds like overkill. If you prefer, as debug info
> > formats other than dwarf2 are just legacy anyway, we could drop the dbxout
> > special case and just do && write_symbols == NO_DEBUG or
> > && debug_info_level == DINFO_LEVEL_NONE.
> >
> > And yes, all dwarf versions can express at least some of the initializers.
>
> Then I'd say do && debug_info_level <= DINFO_LEVEL_TERSE.
That would still mean we can fail bootstrap with -O2 -g1, if there is a
DEBUG_IMPLICIT_PTR created during RTL expansion to some unused var, then
that var's varpool node is varpool_remove_node removed and initializer
cleared, and dwarf2out_finish would want to make_decl_rtl_for_debug again.
Jakub