[Bug debug/86452] ICE in force_decl_die, at dwarf2out.c:25922 with -g1 and -flto

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Jul 11 12:39:00 GMT 2018


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=86452

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |ASSIGNED
                 CC|                            |dodji at gcc dot gnu.org
           Assignee|unassigned at gcc dot gnu.org      |rguenth at gcc dot gnu.org

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
It looks like the error is simply that

  /* If type is an anonymous tagged type named by a typedef, let's
     generate debug info for the typedef.  */
  if (is_naming_typedef_decl (TYPE_NAME (type)))
    {
      /* Use the DIE of the containing namespace as the parent DIE of
         the type description DIE we want to generate.  */
      if (DECL_CONTEXT (TYPE_NAME (type))
          && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL)
        context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type)));

is using get_context_die rather than

        context_die = scope_die_for (type, context_die);

which fixes the ICE.

I believe the conditional can also be elided but that could be a separate
thing to test (testcase also works).

The above was introduced with r160347.

Thus I am testing the following:

Index: gcc/dwarf2out.c
===================================================================
--- gcc/dwarf2out.c     (revision 262551)
+++ gcc/dwarf2out.c     (working copy)
@@ -25378,11 +25378,8 @@ gen_type_die_with_usage (tree type, dw_d
      generate debug info for the typedef.  */
   if (is_naming_typedef_decl (TYPE_NAME (type)))
     {
-      /* Use the DIE of the containing namespace as the parent DIE of
-         the type description DIE we want to generate.  */
-      if (DECL_CONTEXT (TYPE_NAME (type))
-         && TREE_CODE (DECL_CONTEXT (TYPE_NAME (type))) == NAMESPACE_DECL)
-       context_die = get_context_die (DECL_CONTEXT (TYPE_NAME (type)));
+      /* Give typedefs the right scope.  */
+      context_die = scope_die_for (type, context_die);

       gen_decl_die (TYPE_NAME (type), NULL, NULL, context_die);
       return;


More information about the Gcc-bugs mailing list