diff mbox

Fix ICE with -feliminate-dwarf2-dups or -gdwarf-4 (PR debug/46123)

Message ID 20101126163706.GP29412@tyan-ft48-01.lab.bos.redhat.com
State New
Headers show

Commit Message

Jakub Jelinek Nov. 26, 2010, 4:37 p.m. UTC
On Fri, Nov 26, 2010 at 09:56:17AM -0500, Jason Merrill wrote:
> On 11/26/2010 08:41 AM, Jakub Jelinek wrote:
> >Actually no, the reason we aren't splitting is -O0 and the function
> >not having always_inline attribute.
> >We don't split any inlines into abstract/concrete DIEs when no inlining
> >is performed.
> 
> Right, but this PR seems to indicate that this should be changed.

 	        * just

doesn't help though, it still ICEs.  Without -feliminate-dwarf2-dups or
-gdwarf-4 it shows that abstract and concrete DIEs are separate, but
both are children of the same DW_TAG_structure_type "baz".

	Jakub

Comments

Jason Merrill Nov. 27, 2010, 5:51 a.m. UTC | #1
On 11/26/2010 11:37 AM, Jakub Jelinek wrote:
> +      else if ((cgraph_function_possibly_inlined_p (decl)
> +		|| DECL_DECLARED_INLINE_P (decl))
>
> doesn't help though, it still ICEs.  Without -feliminate-dwarf2-dups or
> -gdwarf-4 it shows that abstract and concrete DIEs are separate, but
> both are children of the same DW_TAG_structure_type "baz".

Right, so the concrete instance needs to move to be under comp_unit_die. 
  A comment in gen_subprogram_die says "We always want the DIE for this 
function that has the *_pc attributes to be under comp_unit_die so the 
debugger can find it."  But it's not clear to me right now what code is 
trying to make that happen.

Jason
Jakub Jelinek Nov. 29, 2010, 11:13 a.m. UTC | #2
On Sat, Nov 27, 2010 at 12:51:07AM -0500, Jason Merrill wrote:
> On 11/26/2010 11:37 AM, Jakub Jelinek wrote:
> >+      else if ((cgraph_function_possibly_inlined_p (decl)
> >+		|| DECL_DECLARED_INLINE_P (decl))
> >
> >doesn't help though, it still ICEs.  Without -feliminate-dwarf2-dups or
> >-gdwarf-4 it shows that abstract and concrete DIEs are separate, but
> >both are children of the same DW_TAG_structure_type "baz".
> 
> Right, so the concrete instance needs to move to be under
> comp_unit_die.  A comment in gen_subprogram_die says "We always want
> the DIE for this function that has the *_pc attributes to be under
> comp_unit_die so the debugger can find it."  But it's not clear to
> me right now what code is trying to make that happen.

It is dwarf2out_finish:
  for (node = limbo_die_list; node; node = next_node)
    {
      dw_die_ref die = node->die;
      next_node = node->next;

      if (die->die_parent == NULL)
        {
          dw_die_ref origin = get_AT_ref (die, DW_AT_abstract_origin);

          if (origin)
            add_child_die (origin->die_parent, die);
...
which places the limbo nodes at origin's parent.  BTW, the ICE
happens with -O2 -gdwarf-4 -fkeep-inline-function mangle3.C or
-O2 -feliminate-dwarf2-dups -fkeep-inline-functions mangle3.C
as well.

	Jakub
diff mbox

Patch

--- dwarf2out.c.jj	2010-11-19 20:56:54.000000000 +0100
+++ dwarf2out.c	2010-11-26 17:26:25.000000000 +0100
@@ -20837,7 +20837,8 @@  gen_decl_die (tree decl, tree origin, dw
 
       /* If we're emitting an out-of-line copy of an inline function,
 	 emit info for the abstract instance and set up to refer to it.  */
-      else if (cgraph_function_possibly_inlined_p (decl)
+      else if ((cgraph_function_possibly_inlined_p (decl)
+		|| DECL_DECLARED_INLINE_P (decl))
 	       && ! DECL_ABSTRACT (decl)
 	       && ! class_or_namespace_scope_p (context_die)
 	       /* dwarf2out_abstract_function won't emit a die if this is