https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82011
--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> --- Ok, so a simple checking patch like the following unfortunately fires right and left, restricting it to DW_AT_inline doesn't fire for me on the testcase you mention (add || a->dw_attr != DW_AT_inline to the assert condition). Can you check if that fires for you? Index: gcc/dwarf2out.c =================================================================== --- gcc/dwarf2out.c (revision 251399) +++ gcc/dwarf2out.c (working copy) @@ -4122,6 +4122,16 @@ add_dwarf_attr (dw_die_ref die, dw_attr_ if (die == NULL) return; + if (flag_checking) + { + /* Check we do not add duplicate attrs. Can't use get_AT here + because that recurses to the specification/abstract origin DIE. */ + dw_attr_node *a; + unsigned ix; + FOR_EACH_VEC_SAFE_ELT (die->die_attr, ix, a) + gcc_assert (a->dw_attr != attr->dw_attr); + } + vec_safe_reserve (die->die_attr, 1); vec_safe_push (die->die_attr, *attr); }