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

--- Comment #7 from Richard Biener <rguenth at gcc dot gnu.org> ---
OK, so it's of course set_decl_origin_self () invoked via

#0  set_decl_origin_self (decl=<label_decl 0x7ffff684f400 no_change>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23321
#1  0x00000000014ddc14 in set_block_origin_self (stmt=<block 0x7ffff6c05cc0>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23290
#2  0x00000000014dde88 in set_decl_origin_self (
    decl=<function_decl 0x7ffff6842400 ReduceTrapIf>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23329
#3  0x00000000014de0c8 in dwarf2out_abstract_function (
    decl=<function_decl 0x7ffff6842400 ReduceTrapIf>)
    at /home/rguenther/src/trunk/gcc/dwarf2out.cc:23379
#4  0x0000000001c0bce5 in tree_function_versioning (
    old_decl=<function_decl 0x7ffff6842400 ReduceTrapIf>, 
    new_decl=<function_decl 0x7ffff6883500
_ZN24BranchEliminationReducerI12ReducerStackIiJ26MachineOptimizationReducerN12_GLOBAL__N_121ValueNumberingReducerEEEE12ReduceTrapIfE7OpIndexbNS2_6TrapIdE.part.0>,
tree_map=0x0, 
    param_adjustments=0x4c3ad30, update_clones=false, 
    blocks_to_copy=0x4be47a8, new_entry=<basic_block 0x7ffff6872600 (4)>)
    at /home/rguenther/src/trunk/gcc/tree-inline.cc:6222
#5  0x000000000144476f in cgraph_node::create_version_clone_with_body (
    this=<cgraph_node * const 0x7ffff6a23bb0 "ReduceTrapIf"/8>, 
    redirect_callers=..., tree_map=0x0, param_adjustments=0x4c3ad30, 
    bbs_to_copy=0x4be47a8, new_entry_block=<basic_block 0x7ffff6872600 (4)>, 
    suffix=0x434dc0d "part", target_attributes=<tree 0x0>, version_decl=true)
    at /home/rguenther/src/trunk/gcc/cgraphclones.cc:1084
#6  0x000000000343c0d4 in split_function (
    return_bb=<basic_block 0x7ffff68654e0 (EXIT)>, 
    split_point=0x4b13ba0 <best_split_point>, add_tsan_func_exit=false)
    at /home/rguenther/src/trunk/gcc/ipa-split.cc:1376

interesting enough we didn't generate a DIE for the LABEL_DECL for the
abstract instance DIE.  Instead we just have

(gdb) p debug_dwarf_die (old_die)
DIE  262: DW_TAG_subprogram (0x7ffff6867dc0)
  abbrev id: 4 offset: 262 mark: 0
  DW_AT_name: "ReduceTrapIf"
  DW_AT_decl_file: "t.ii" (1)
  DW_AT_decl_line: 102
  DW_AT_decl_column: 11
  DW_AT_inline: 3

there.  During early dwarf generation for this function we do not consider
it possibly inlined, so

      /* If we're emitting a possibly inlined function emit it as
         abstract instance.  */
      else if (cgraph_function_possibly_inlined_p (decl)
               && ! DECL_ABSTRACT_P (decl)
               && ! class_or_namespace_scope_p (context_die)
               /* dwarf2out_abstract_function won't emit a die if this is just
                  a declaration.  We must avoid setting DECL_ABSTRACT_ORIGIN in
                  that case, because that works only if we have a die.  */
               && DECL_INITIAL (decl) != NULL_TREE)
        dwarf2out_abstract_function (decl);

doesn't trigger and

      /* Otherwise we're emitting the primary DIE for this decl.  */
      else if (debug_info_level > DINFO_LEVEL_TERSE)

neither.

Instead we just generate the plain decl DIE.  But we still do
dwarf2out_abstract_function later for the clone origin.

It's a bit complicated (-g1 wrecks quite some invariants), so I think I'm
going to try fixup after the fact in LTO.

Reply via email to