Hi,
this problem here seems to be that is_cxx returns true and at the same
time auto_die and decltype_auto_die is not initialized. Here die==NULL
and we end up calling add_type_attribute for random reasons.

I am testing the following but I am not sure it is proper fix.  Are
we supposed to handle auto dies here somehow?

Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 261841)
+++ dwarf2out.c (working copy)
@@ -22830,7 +22830,8 @@ gen_subprogram_die (tree decl, dw_die_re
          if (is_cxx () && debug_info_level > DINFO_LEVEL_TERSE)
            {
              dw_die_ref die = get_AT_ref (old_die, DW_AT_type);
-             if (die == auto_die || die == decltype_auto_die)
+             /* In LTO auto_die and decltype_auto_die may be NULL.  */
+             if (die && (die == auto_die || die == decltype_auto_die))
                add_type_attribute (subr_die, TREE_TYPE (TREE_TYPE (decl)),
                                    TYPE_UNQUALIFIED, false, context_die);
            }

Reply via email to