With LTO it's easy to run out of linemap encoding space (surprisingly
so for columns even though LTO never uses any column besides zero...).
But some code cannot deal with locations being dropped to zero
"after the fact" (without LTO you do not get re-encoding), in this
example it is the inline-entry markers which assert that the
corresponding BLOCK has a location associated with an inline.

The fix here is to drop those stmts when we end up re-encoding
a formerly inlined_function_outer_scope_p as UNKNOWN_LOCATION.

Bootstrapped on x86_64-unknown-linux-gnu, testing in progress.

Richard.

2019-07-23  Richard Biener  <rguent...@suse.de>

        PR debug/91231
        * lto-streamer-in.c (input_function): Drop inline-entry markers
        that ended up with an unknown location block.

Index: gcc/lto-streamer-in.c
===================================================================
--- gcc/lto-streamer-in.c       (revision 273718)
+++ gcc/lto-streamer-in.c       (working copy)
@@ -1140,6 +1140,14 @@ input_function (tree fn_decl, struct dat
                      ? !MAY_HAVE_DEBUG_MARKER_STMTS
                      : !MAY_HAVE_DEBUG_BIND_STMTS))
                remove = true;
+             /* In case the linemap overflows locations can be dropped
+                to zero.  Thus do not keep nonsensical inline entry markers
+                we'd later ICE on.  */
+             tree block;
+             if (gimple_debug_inline_entry_p (stmt)
+                 && (block = gimple_block (stmt))
+                 && !inlined_function_outer_scope_p (block))
+               remove = true;
              if (is_gimple_call (stmt)
                  && gimple_call_internal_p (stmt))
                {

Reply via email to