Richard Biener <rguenth at gcc dot> changed:

           What    |Removed                     |Added
           Priority|P3                          |P1
   Target Milestone|---                         |8.0
            Summary|ICE in force_decl_die, at   |[8 Regression] ICE in
                   |dwarf2out.c:25910           |force_decl_die, at
                   |                            |dwarf2out.c:25910

--- Comment #6 from Richard Biener <rguenth at gcc dot> ---
In the end caused by -g1 not generating DIEs for NAMESPACE_DECLs.  At
the DIEs are rooted at comp_unit_die () but LTO expects to re-generate the
DIE child->parent relationship via DECL/TYPE_CONTEXT, we do not stream that
(because DIEs lack a back-mapping to the tree it was generated off, rightfully

So we have to mimick that in dwarf2out_register_external_die.

Index: gcc/dwarf2out.c
--- gcc/dwarf2out.c     (revision 259069)
+++ gcc/dwarf2out.c     (working copy)
@@ -5903,8 +5903,13 @@ dwarf2out_register_external_die (tree de
     ctx = DECL_CONTEXT (decl);
+  /* Peel types in the context stack.  */
   while (ctx && TYPE_P (ctx))
     ctx = TYPE_CONTEXT (ctx);
+  /* Likewise namespaces in case we do not want to emit DIEs for them.  */
+  if (debug_info_level <= DINFO_LEVEL_TERSE)
+    while (ctx && TREE_CODE (ctx) == NAMESPACE_DECL)
+      ctx = DECL_CONTEXT (ctx);
   if (ctx)
       if (TREE_CODE (ctx) == BLOCK)

Reply via email to