The following avoids PR71907 (tree_nonartificial_location failing)
by making sure to not completely drop BLOCK_ABSTRACT_ORIGIN but instead
add self-references (a "this has been inlined flag basically") for
BLOCKs not being inlined_function_outer_scope_p.

LTO bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Without this all fortify warnings are now silent as GCC 6 honors
the in-system-header flag of locations (-Wsystem-headers make them
appear again).

Richard.

2016-07-18  Richard Biener  <rguent...@suse.de>

        PR lto/71907
        * lto-streamer-out.c (DFS::DFS_write_tree_body): For blocks
        with an abstract origin that is not an inlined function outer
        scope add a self-reference as abstract origin.
        * tree-streamer-out.c (write_ts_block_tree_pointers): Likewise.

Index: gcc/lto-streamer-out.c
===================================================================
*** gcc/lto-streamer-out.c      (revision 238426)
--- gcc/lto-streamer-out.c      (working copy)
*************** DFS::DFS_write_tree_body (struct output_
*** 890,901 ****
        /* Follow BLOCK_ABSTRACT_ORIGIN for the limited cases we can
         handle - those that represent inlined function scopes.
         For the drop rest them on the floor instead of ICEing
!        in dwarf2out.c.  */
        if (inlined_function_outer_scope_p (expr))
        {
          tree ultimate_origin = block_ultimate_origin (expr);
          DFS_follow_tree_edge (ultimate_origin);
        }
        /* Do not follow BLOCK_NONLOCALIZED_VARS.  We cannot handle debug
         information for early inlined BLOCKs so drop it on the floor instead
         of ICEing in dwarf2out.c.  */
--- 890,905 ----
        /* Follow BLOCK_ABSTRACT_ORIGIN for the limited cases we can
         handle - those that represent inlined function scopes.
         For the drop rest them on the floor instead of ICEing
!        in dwarf2out.c, but keep the notion of whether the block
!        is an inlined block by refering to itself for the sake of
!        tree_nonartificial_location.  */
        if (inlined_function_outer_scope_p (expr))
        {
          tree ultimate_origin = block_ultimate_origin (expr);
          DFS_follow_tree_edge (ultimate_origin);
        }
+       else if (BLOCK_ABSTRACT_ORIGIN (expr))
+       DFS_follow_tree_edge (expr);
        /* Do not follow BLOCK_NONLOCALIZED_VARS.  We cannot handle debug
         information for early inlined BLOCKs so drop it on the floor instead
         of ICEing in dwarf2out.c.  */
Index: gcc/tree-streamer-out.c
===================================================================
*** gcc/tree-streamer-out.c     (revision 238426)
--- gcc/tree-streamer-out.c     (working copy)
*************** write_ts_block_tree_pointers (struct out
*** 807,820 ****
  
    /* Stream BLOCK_ABSTRACT_ORIGIN for the limited cases we can handle - those
       that represent inlined function scopes.
!      For the rest them on the floor instead of ICEing in dwarf2out.c.  */
    if (inlined_function_outer_scope_p (expr))
      {
        tree ultimate_origin = block_ultimate_origin (expr);
        stream_write_tree (ob, ultimate_origin, ref_p);
      }
    else
!     stream_write_tree (ob, NULL_TREE, ref_p);
    /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug 
information
       for early inlined BLOCKs so drop it on the floor instead of ICEing in
       dwarf2out.c.  */
--- 807,823 ----
  
    /* Stream BLOCK_ABSTRACT_ORIGIN for the limited cases we can handle - those
       that represent inlined function scopes.
!      For the rest them on the floor instead of ICEing in dwarf2out.c, but
!      keep the notion of whether the block is an inlined block by refering
!      to itself for the sake of tree_nonartificial_location.  */
    if (inlined_function_outer_scope_p (expr))
      {
        tree ultimate_origin = block_ultimate_origin (expr);
        stream_write_tree (ob, ultimate_origin, ref_p);
      }
    else
!     stream_write_tree (ob, (BLOCK_ABSTRACT_ORIGIN (expr)
!                           ? expr : NULL_TREE), ref_p);
    /* Do not stream BLOCK_NONLOCALIZED_VARS.  We cannot handle debug 
information
       for early inlined BLOCKs so drop it on the floor instead of ICEing in
       dwarf2out.c.  */

Reply via email to