[patch] Fix PR lto/48492 (bis)

Eric Botcazou ebotcazou@adacore.com
Mon Apr 18 21:40:00 GMT 2011


Hi,

this is the second ICE during an LTO bootstrap with Ada enabled: the assertion 
at dwarf2out.c:11422 fails:

11422                 gcc_assert (AT_ref (a)->die_offset);

It's again a fallout of the DW_TAG_GNU_call_site patch:

(gdb) p debug_dwarf_die(die)
DIE 1022787: DW_TAG_GNU_call_site (0x7ffff3d20640)
  abbrev id: 103 offset: 1022787 mark: 1
  DW_AT_low_pc: label: *.LVL21357
  DW_AT_abstract_origin: die -> 0 (0x7ffff31f62d0)
  DW_AT_sibling: die -> 1022817 (0x7ffff3d20730)
    DIE 1022804: DW_TAG_GNU_call_site_parameter (0x7ffff3d20690)
      abbrev id: 48 offset: 1022804 mark: 1
      DW_AT_location: location descriptor
      DW_AT_GNU_call_site_value: location descriptor
    DIE 1022810: DW_TAG_GNU_call_site_parameter (0x7ffff3d206e0)
      abbrev id: 48 offset: 1022810 mark: 1
      DW_AT_location: location descriptor
      DW_AT_GNU_call_site_value: location descriptor

DW_AT_abstract_origin link:

(gdb) p debug_dwarf_die(0x7ffff31f62d0)
DIE    0: DW_TAG_subprogram (0x7ffff31f62d0)
  abbrev id: 0 offset: 0 mark: 2                          <---- zero offset!
  DW_AT_abstract_origin: die -> 1067604 (0x7ffff13b3820)
  DW_AT_low_pc: label: *.LFB4069
  DW_AT_high_pc: label: *.LFE4069
  DW_AT_frame_base: location list -> label:*.LLST6555
  DW_AT_static_link: location descriptor

DW_AT_abstract_origin link:

DIE 1067604: DW_TAG_subprogram (0x7ffff13b3820)
  abbrev id: 12 offset: 1067604 mark: 1
  DW_AT_name: "sem_ch10__build_limited_views__new_internal_shadow_entity"
  DW_AT_decl_file: "/home/eric/svn/gcc/gcc/ada/sem_ch10.adb" (66)
  DW_AT_decl_line: 5540
  DW_AT_prototyped: 1
  DW_AT_type: die -> 194 (0x7ffff15762d0)
  DW_AT_inline: 1


In the source file:

                  Lim_Typ :=
                    New_Internal_Shadow_Entity
                      (Kind       => Ekind (Comp_Typ),
                       Sloc_Value => Sloc (Comp_Typ),
                       Id_Char    => 'Z');

In the assembly file:

	call	atree__ekind
	movzbl	%al, %edi
	movq	%rbx, %r10
	movl	%r13d, %esi
	call	
sem_ch10__build_limited_views__new_internal_shadow_entity.4857.134033.constprop.66.6913

(gdb) p debug_tree(decl)
 <function_decl 0x7ffff6c4dc00 
sem_ch10__build_limited_views__new_internal_shadow_entity.4857.134033.constprop.66

whose DECL_CONTEXT is:

<function_decl 0x7ffff6c4da00 sem_ch10__build_limited_views
    type <function_type 0x7ffff70e3f18
        type <void_type 0x7ffff7ee0d20 void asm_written VOID
            align 8 symtab 0 alias set -1 canonical type 0x7ffff7ee0d20
            pointer_to_this <pointer_type 0x7ffff7ee0dc8>>
        QI
        size <integer_cst 0x7ffff7ed0f80 constant 8>
        unit size <integer_cst 0x7ffff7ed0fa0 constant 1>
        align 8 symtab 0 alias set -1 canonical type 0x7ffff70e3f18
        arg-types <tree_list 0x7ffff70f5258 value <integer_type 0x7ffff7ee0540 
unsigned int>
            chain <tree_list 0x7ffff70f5280 value <void_type 0x7ffff7ee0d20 
void>>>
        pointer_to_this <pointer_type 0x7ffff6536930>>
    addressable nothrow static QI file /home/eric/svn/gcc/gcc/ada/sem_ch10.adb 
line 5246 col 4 align 8 initial <error_mark 0x7ffff7ed7990>

This DECL is stream out as DECL_CONTEXT but isn't in the LTRANS partition so 
its DECL_INITIAL is ERROR_MARK and its nested functions aren't declared with 
the DWARF back-end.  As a result, both DW_TAG_subprogram DIEs above end up on 
the limbo list, in the above order.  So when:

	  dw_die_ref origin = get_AT_ref (die, DW_AT_abstract_origin);

	  if (origin)
	    add_child_die (origin->die_parent, die);

is run, origin->die_parent is NULL for the first DIE; it will only be set when 
the second DIE is processed on the limbo list.

Hence the proposed fix: not to attach a DIE to a NULL parent.  LTO bootstrapped 
with Ada on x86_64-suse-linux, OK for the mainline?


2011-04-18  Eric Botcazou  <ebotcazou@adacore.com>

	PR lto/48492
	* dwarf2out.c (dwarf2out_finish): Do not attach a DIE on the limbo list
	to a NULL parent.


-- 
Eric Botcazou
-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.diff
Type: text/x-diff
Size: 426 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20110418/572e3e6e/attachment.bin>


More information about the Gcc-patches mailing list