From: Jakub Jelinek Date: Thu, 16 Feb 2012 08:50:02 +0000 (+0100) Subject: re PR debug/52260 (ICE in clone_tree_hash, at dwarf2out.c:7424) X-Git-Tag: releases/gcc-4.6.3~75 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fdb065a8763ae273fe8007072402bcfe4e5fd71c;p=thirdparty%2Fgcc.git re PR debug/52260 (ICE in clone_tree_hash, at dwarf2out.c:7424) PR debug/52260 * dwarf2out.c (copy_decls_walk): Fill in *slot before traversing children with clone_tree_hash, not after it. * g++.dg/debug/dwarf2/pr52260.C: New test. From-SVN: r184304 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 578f1ee1f1d2..7ca0177fc066 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2012-02-16 Jakub Jelinek + + PR debug/52260 + * dwarf2out.c (copy_decls_walk): Fill in *slot before traversing + children with clone_tree_hash, not after it. + 2012-02-15 Michael Meissner Backport from mainline diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 1ed3d5ad5d96..025593cef227 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10474,14 +10474,6 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table) dw_die_ref parent = unit; dw_die_ref copy = clone_die (targ); - FOR_EACH_CHILD (targ, c, - add_child_die (copy, - clone_tree_hash (c, decl_table))); - - /* Make sure the cloned tree is marked as part of the - type unit. */ - mark_dies (copy); - /* Record in DECL_TABLE that TARG has been copied. Need to do this now, before the recursive call, because DECL_TABLE may be expanded and SLOT @@ -10491,6 +10483,14 @@ copy_decls_walk (dw_die_ref unit, dw_die_ref die, htab_t decl_table) entry->copy = copy; *slot = entry; + FOR_EACH_CHILD (targ, c, + add_child_die (copy, + clone_tree_hash (c, decl_table))); + + /* Make sure the cloned tree is marked as part of the + type unit. */ + mark_dies (copy); + /* If TARG has surrounding context, copy its ancestor tree into the new type unit. */ if (targ->die_parent != NULL diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 3e74b86e396b..acc5463c4099 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2012-02-16 Jakub Jelinek + + PR debug/52260 + * g++.dg/debug/dwarf2/pr52260.C: New test. + 2012-02-15 Michael Meissner Backport from mainline diff --git a/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C b/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C new file mode 100644 index 000000000000..9ab2589ce116 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C @@ -0,0 +1,133 @@ +// PR debug/52260 +// { dg-do compile } +// { dg-options "-gdwarf-4 -std=c++0x" } + +namespace { typedef decltype (nullptr) T1; } +struct B {}; +namespace A +{ + template + struct C { static constexpr T value = __v; }; + typedef C D; + template + struct E : D {}; + template + struct F : C ::value)> {}; + template + struct G { typedef T t; }; +} +template +struct H {}; +namespace A +{ + template + struct I : H {}; + template struct J; + template struct K; + struct L + { + template + struct M + { + template static bool m2 (T) { return false; } + }; + }; + template struct N; + template + struct N : L::M {}; + template + struct K :J <,>, L + { + typedef T O (B4 ...); + struct P {}; + template K (B2, typename G ::value, P>::t = P ()); + }; + template + template + K ::K (B2 __f, typename G ::value, P>::t) + { + typedef N Q; + Q::m2 (__f); + }; +} +enum R { r1 }; +const R r2 = r1; +namespace A +{ + template + struct S {}; + template > + struct U {}; + template + struct V { T *operator -> (); }; + template + struct W : V + { + W (const W &); + W (T1) {} + W & operator= (W) {} + }; + template struct Z; + struct AA + { + struct AB + { + struct AC { void operator () () {} }; + }; + template using AD = U ; + struct AE + { + typedef AD AZ; + virtual ~AE (); + void o3 (K , bool = false) {} + template struct AY; + struct C1 {}; + template struct AY + { + AZ operator () () { return AZ (); } + Z _M_Z; + }; + template + static AY _s1 (B, Z *); + }; + }; + template <> + struct Z + { + typedef AA::AE AF; + W o4; + void foo (B __p) + { + auto _s1 = AF::_s1 (__p, this); + o4->o3 (_s1); + } + }; + template + struct AG {}; + template > + struct AH : AG + { + void bar (T) { baz (); } + template + void baz (_Args && ...); + }; + template + template + void AH ::baz (_Args && ...) {} + namespace + { + typedef A::K AI; + struct AF + { + int v2; + AI v1; + AF (int, unsigned, AI __t) : v2 (), v1 (__t) {} + }; + struct D3 : A::AH + { + typedef AF AFT; + void v3 (AI __t) { bar (AFT (4, v4, __t)); } + int v4; + }; + } +}