]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR debug/52260 (ICE in clone_tree_hash, at dwarf2out.c:7424)
authorJakub Jelinek <jakub@redhat.com>
Thu, 16 Feb 2012 08:50:02 +0000 (09:50 +0100)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 16 Feb 2012 08:50:02 +0000 (09:50 +0100)
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

gcc/ChangeLog
gcc/dwarf2out.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/dwarf2/pr52260.C [new file with mode: 0644]

index 578f1ee1f1d2000b191a0f2601141f33e5afd744..7ca0177fc0668d544b8b9fa7548a196464a6c9d5 100644 (file)
@@ -1,3 +1,9 @@
+2012-02-16  Jakub Jelinek  <jakub@redhat.com>
+
+       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  <meissner@linux.vnet.ibm.com>
 
        Backport from mainline
index 1ed3d5ad5d96d5a7e6c1e00f87a5fad5ed5f2392..025593cef2275c23ee3c3b612ee3b51d18bf28c4 100644 (file)
@@ -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
index 3e74b86e396b8c7f65725d5e33dc12826f6be818..acc5463c409952509562098b2064daf382624e68 100644 (file)
@@ -1,3 +1,8 @@
+2012-02-16  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/52260
+       * g++.dg/debug/dwarf2/pr52260.C: New test.
+
 2012-02-15  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        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 (file)
index 0000000..9ab2589
--- /dev/null
@@ -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 <typename T, T __v>
+  struct C { static constexpr T value = __v; };
+  typedef C <bool, false> D;
+  template <typename>
+  struct E : D {};
+  template <typename T>
+  struct F : C <bool, (E <T>::value)> {};
+  template <bool, typename T = void>
+  struct G { typedef T t; };
+}
+template <typename T>
+struct H {};
+namespace A
+{
+  template <typename T>
+  struct I : H <T> {};
+  template <typename ...> struct J;
+  template <typename> struct K;
+  struct L
+  {
+    template <typename B2>
+    struct M
+    {
+      template <typename T> static bool m2 (T) { return false; }
+    };
+  };
+  template <typename, typename> struct N;
+  template <typename T, typename B2, typename ... B4>
+  struct N <T (B4 ...), B2> : L::M <B2> {};
+  template <typename T, typename ... B4>
+  struct K <T (B4 ...)> :J <,>, L
+  {
+    typedef T O (B4 ...);
+    struct P {};
+    template <typename B2> K (B2, typename G <!F <B2>::value, P>::t = P ());
+  };
+  template <typename T, typename ... B1>
+  template <typename B2>
+  K <T (B1 ...)>::K (B2 __f, typename G <!F < B2>::value, P>::t)
+  {
+    typedef N <O, B2> Q;
+    Q::m2 (__f);
+  };
+}
+enum R { r1 };
+const R r2 = r1;
+namespace A
+{
+  template <typename>
+  struct S {};
+  template <typename T, typename _Dp = S <T>>
+  struct U {};
+  template <typename T, R _Lp = r2>
+  struct V { T *operator -> (); };
+  template <typename T>
+  struct W : V <T>
+  {
+    W (const W &);
+    W (T1) {}
+    W & operator= (W) {}
+  };
+  template <typename> struct Z;
+  struct AA
+  {
+    struct AB
+    {
+      struct AC { void operator () () {} };
+    };
+    template <typename T> using AD = U <T, AB::AC>;
+    struct AE
+    {
+      typedef AD <AB> AZ;
+      virtual ~AE ();
+      void o3 (K <AZ ()>, bool = false) {}
+      template <typename, typename _Arg> struct AY;
+      struct C1 {};
+      template <typename T> struct AY <T, C1>
+      {
+       AZ operator () () { return AZ (); }
+        Z <T> _M_Z;
+      };
+      template <typename T>
+      static AY <T, C1> _s1 (B, Z <T> *);
+    };
+  };
+  template <>
+  struct Z <void>
+  {
+    typedef AA::AE AF;
+    W <AF> o4;
+    void foo (B __p)
+    {
+      auto _s1 = AF::_s1 (__p, this);
+      o4->o3 (_s1);
+    }
+  };
+  template <typename T, typename _Alloc>
+  struct AG {};
+  template <typename T, typename D1 = A::I <T>>
+  struct AH : AG <T, D1>
+  {
+    void bar (T) { baz (); }
+    template <typename ... _Args>
+    void baz (_Args && ...);
+  };
+  template <typename T, typename D1>
+  template <typename ... _Args>
+  void AH <T, D1>::baz (_Args && ...) {}
+  namespace
+  {
+    typedef A::K <void ()> AI;
+    struct AF
+    {
+      int v2;
+      AI v1;
+      AF (int, unsigned, AI __t) : v2 (), v1 (__t) {}
+    };
+    struct D3 : A::AH <AF>
+    {
+      typedef AF AFT;
+      void v3 (AI __t) { bar (AFT (4, v4, __t)); }
+      int v4;
+    };
+  }
+}