> Hi!
> 
> This patch fixes both a correctness problem (bootstrap failure in
> libgfortran for a couple of targets) and debug info quality issue.
> The correctness issue is about the fact that clearing DECL_INITIAL
> (well, setting it to error_mark_node is the same) in varpool_remove_node
> is changing the decl's bss_initializer_p (decl) status, thus can affect
> section flags of it for DWARF2 if an unused decl has
> e.g. make_decl_rtl_for_debug called from implicit pointer expansion
> before varpool_remove_node and then e.g. during dwarf2out_finish after it.
> This function intentionally doesn't remember the RTL, that could affect
> code generation.
> And for the debug info quality issue see the next patch that actually
> improves use of DECL_INITIAL for debug info generation.
> 
> Even if we add some param to limit the size of the initializers we want to
> emit into debug info, still the varpool_remove_node clearing of the
> initializer would need to be done (if we want to try hard to save compile
> time memory) in a way to keep the bss_initializer_p the same as before,
> so call it before clearing, if it was set, setting it to error_mark_node
> is perhaps fine, if it was set, it needs to be set to some other magic
> value and everything that uses DECL_INITIAL afterwards need to be taught
> about that (including bss_initializer_p not to treat that other magic value
> as bss initializer).
> 
> Bootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?
> 
> 2012-12-06  Jakub Jelinek  <ja...@redhat.com>
> 
>       PR fortran/55395
>       * varpool.c (varpool_remove_node): Don't drop DECL_INITIAL
>       if -g and emitting DWARF2+.

OK.  How we want to handle this with LTO streaming?
There we also put in error_mark_node:
      if (TREE_CODE (expr) == VAR_DECL
          && (TREE_STATIC (expr) || DECL_EXTERNAL (expr))
          && initial)
        {
          lto_symtab_encoder_t encoder;
          struct varpool_node *vnode;

          encoder = ob->decl_state->symtab_node_encoder;
          vnode = varpool_get_node (expr);
          if (!vnode
              || !lto_symtab_encoder_encode_initializer_p (encoder,
                                                            vnode))
            initial = error_mark_node;
        }

      stream_write_tree (ob, initial, ref_p);

Honza

Reply via email to