diff options
author | Richard Biener <rguenther@suse.de> | 2019-01-29 08:12:02 +0000 |
---|---|---|
committer | Richard Biener <rguenth@gcc.gnu.org> | 2019-01-29 08:12:02 +0000 |
commit | 5ee41782266f1f7a8df3e7e711b4b1241badfe3b (patch) | |
tree | 83dc8df3d65ecc3b36cbc7256576e34f05d45a16 /gcc | |
parent | 57f0d303848213c1d82437b8c444afda8b72ede0 (diff) | |
download | gcc-5ee41782266f1f7a8df3e7e711b4b1241badfe3b.zip gcc-5ee41782266f1f7a8df3e7e711b4b1241badfe3b.tar.gz gcc-5ee41782266f1f7a8df3e7e711b4b1241badfe3b.tar.bz2 |
re PR debug/87295 ([early debug] ICE with -ffat-lto-objects -fdebug-types-section -g)
2019-01-29 Richard Biener <rguenther@suse.de>
PR debug/87295
* dwarf2out.c (collect_skeleton_dies): New helper.
(copy_decls_for_unworthy_types): Call it.
(build_abbrev_table): Assert we do not try to replace
DW_AT_signature refs with local refs.
* g++.dg/lto/pr87295_0.C: New testcase.
From-SVN: r268361
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 8 | ||||
-rw-r--r-- | gcc/dwarf2out.c | 33 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/lto/pr87295_0.C | 20 |
4 files changed, 65 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index f5872db..9a3d7d5 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2019-01-29 Richard Biener <rguenther@suse.de> + + PR debug/87295 + * dwarf2out.c (collect_skeleton_dies): New helper. + (copy_decls_for_unworthy_types): Call it. + (build_abbrev_table): Assert we do not try to replace + DW_AT_signature refs with local refs. + 2019-01-28 Jakub Jelinek <jakub@redhat.com> PR middle-end/89002 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 0072270..c2a5901 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -8722,6 +8722,33 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, decl_hash_type *decl_table) FOR_EACH_CHILD (die, c, copy_decls_walk (unit, c, decl_table)); } +/* Collect skeleton dies in DIE created by break_out_comdat_types already + and record them in DECL_TABLE. */ + +static void +collect_skeleton_dies (dw_die_ref die, decl_hash_type *decl_table) +{ + dw_die_ref c; + + if (dw_attr_node *a = get_AT (die, DW_AT_signature)) + { + dw_die_ref targ = AT_ref (a); + gcc_assert (targ->die_mark == 0 && targ->comdat_type_p); + decl_table_entry **slot + = decl_table->find_slot_with_hash (targ, + htab_hash_pointer (targ), + INSERT); + gcc_assert (*slot == HTAB_EMPTY_ENTRY); + /* Record in DECL_TABLE that TARG has been already copied + by remove_child_or_replace_with_skeleton. */ + decl_table_entry *entry = XCNEW (struct decl_table_entry); + entry->orig = targ; + entry->copy = die; + *slot = entry; + } + FOR_EACH_CHILD (die, c, collect_skeleton_dies (c, decl_table)); +} + /* Copy declarations for "unworthy" types into the new comdat section. Incomplete types, modified types, and certain other types aren't broken out into comdat sections of their own, so they don't have a signature, @@ -8733,6 +8760,7 @@ copy_decls_for_unworthy_types (dw_die_ref unit) { mark_dies (unit); decl_hash_type decl_table (10); + collect_skeleton_dies (unit, &decl_table); copy_decls_walk (unit, unit, &decl_table); unmark_dies (unit); } @@ -9029,7 +9057,10 @@ build_abbrev_table (dw_die_ref die, external_ref_hash_type *extern_map) if (is_type_die (c) && (ref_p = lookup_external_ref (extern_map, c)) && ref_p->stub && ref_p->stub != die) - change_AT_die_ref (a, ref_p->stub); + { + gcc_assert (a->dw_attr != DW_AT_signature); + change_AT_die_ref (a, ref_p->stub); + } else /* We aren't changing this reference, so mark it external. */ set_AT_ref_external (a, 1); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 9798783..e03b37e 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2019-01-29 Richard Biener <rguenther@suse.de> + + PR debug/87295 + * g++.dg/lto/pr87295_0.C: New testcase. + 2019-01-29 Jakub Jelinek <jakub@redhat.com> PR c/89045 diff --git a/gcc/testsuite/g++.dg/lto/pr87295_0.C b/gcc/testsuite/g++.dg/lto/pr87295_0.C new file mode 100644 index 0000000..a063b23 --- /dev/null +++ b/gcc/testsuite/g++.dg/lto/pr87295_0.C @@ -0,0 +1,20 @@ +// { dg-lto-do assemble } +// { dg-lto-options { { -flto -ffat-lto-objects -fdebug-types-section -g -std=gnu++17 } } } + +template<typename _Tp, _Tp __v> +struct integral_constant +{ + static constexpr _Tp value = __v; + typedef _Tp value_type; + constexpr operator value_type() const noexcept { return value; } +}; + +typedef integral_constant<bool, false> false_type; + +template<typename...> +struct __or_; + +template<> +struct __or_<> + : public false_type +{ }; |