On Tue, 28 Jan 2014, Jakub Jelinek wrote:

> On Tue, Jan 28, 2014 at 10:40:51AM +0100, Richard Biener wrote:
> > The patch doesn't make much sense to me.  I think the problem is that
> > NAMELIST_DECL is output in a ref section (LTO_namelist_decl_ref) but
> > the output routine writes other refs (via stream_write_tree and
> > outputting the constructor).  lto_output_tree_ref may not do this
> > kind of stuff.  Instead the contents of a NAMELIST_DECL need to be
> > output from the generic tree writing routines.
> > 
> > Where are NAMELIST_DECLs possibly refered from?
> 
> I think usually from BLOCK_VARS of some BLOCK.

The following seems to fix things for me - bootstrap / regtest and
SPEC 2k6 LTO -g build in progress.

Now somebody could verify if LTO produces sensible debuginfo for
NAMELIST_DECLs.

Richard.

2014-02-04  Richard Biener  <rguent...@suse.de>

        PR lto/59723
        * lto-streamer-out.c (lto_output_tree_ref): Do not write
        trees from lto_output_tree_ref.

Index: gcc/lto-streamer-out.c
===================================================================
*** gcc/lto-streamer-out.c      (revision 207455)
--- gcc/lto-streamer-out.c      (working copy)
*************** lto_output_tree_ref (struct output_block
*** 255,273 ****
        break;
  
      case NAMELIST_DECL:
!       {
!       unsigned i;
!       tree value, tmp;
! 
!       streamer_write_record_start (ob, LTO_namelist_decl_ref);
!       stream_write_tree (ob, DECL_NAME (expr), true);
!       tmp = NAMELIST_DECL_ASSOCIATED_DECL (expr);
!       gcc_assert (tmp != NULL_TREE);
!       streamer_write_uhwi (ob, CONSTRUCTOR_ELTS (tmp)->length());
!       FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (tmp), i, value)
!         lto_output_var_decl_index (ob->decl_state, ob->main_stream, value);
!       break;
!       }
  
      case NAMESPACE_DECL:
        streamer_write_record_start (ob, LTO_namespace_decl_ref);
--- 261,269 ----
        break;
  
      case NAMELIST_DECL:
!       streamer_write_record_start (ob, LTO_namelist_decl_ref);
!       lto_output_var_decl_index (ob->decl_state, ob->main_stream, expr);
!       break;
  
      case NAMESPACE_DECL:
        streamer_write_record_start (ob, LTO_namespace_decl_ref);

Reply via email to