]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/56819 (ICE: SIGSEGV in int_cst_value (tree.h:4013) with -fcompare-debug)
authorJakub Jelinek <jakub@redhat.com>
Wed, 3 Apr 2013 19:44:02 +0000 (21:44 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Wed, 3 Apr 2013 19:44:02 +0000 (21:44 +0200)
PR debug/56819
* tree.c (strip_typedefs): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT
from args to new_args.
(strip_typedefs_expr): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT from t to
r instead of doing {S,G}ET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.

* g++.dg/debug/pr56819.C: New test.

From-SVN: r197454

gcc/cp/ChangeLog
gcc/cp/tree.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/debug/pr56819.C [new file with mode: 0644]

index bd0368b400d02af86c9d779cb3b7b5a67ce18c94..1194e9a65e3cf6760350828a4ff80ca7068b3abe 100644 (file)
@@ -1,3 +1,11 @@
+2013-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/56819
+       * tree.c (strip_typedefs): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT
+       from args to new_args.
+       (strip_typedefs_expr): Copy NON_DEFAULT_TEMPLATE_ARGS_COUNT from t to
+       r instead of doing {S,G}ET_NON_DEFAULT_TEMPLATE_ARGS_COUNT.
+
 2013-04-01  Jason Merrill  <jason@redhat.com>
 
        PR c++/56794
index b4a538645daaaa5a3fd15f215df96cca4bc54176..f5a43853b8707eb4bbab4ee54f962e2246c84370 100644 (file)
@@ -1229,8 +1229,13 @@ strip_typedefs (tree t)
                  changed = true;
              }
            if (changed)
-             fullname = lookup_template_function (TREE_OPERAND (fullname, 0),
-                                                  new_args);
+             {
+               NON_DEFAULT_TEMPLATE_ARGS_COUNT (new_args)
+                 = NON_DEFAULT_TEMPLATE_ARGS_COUNT (args);
+               fullname
+                 = lookup_template_function (TREE_OPERAND (fullname, 0),
+                                             new_args);
+             }
            else
              ggc_free (new_args);
          }
@@ -1363,8 +1368,8 @@ strip_typedefs_expr (tree t)
            r = copy_node (t);
            for (i = 0; i < n; ++i)
              TREE_VEC_ELT (r, i) = VEC_index (tree, vec, i);
-           SET_NON_DEFAULT_TEMPLATE_ARGS_COUNT
-             (r, GET_NON_DEFAULT_TEMPLATE_ARGS_COUNT (t));
+           NON_DEFAULT_TEMPLATE_ARGS_COUNT (r)
+             = NON_DEFAULT_TEMPLATE_ARGS_COUNT (t);
          }
        else
          r = t;
index 461a7b63569ff11aad6f3fb3795ac995df338ebf..27b507c16d17034042b0fbc8d890cedf7ba63062 100644 (file)
@@ -1,3 +1,8 @@
+2013-04-03  Jakub Jelinek  <jakub@redhat.com>
+
+       PR debug/56819
+       * g++.dg/debug/pr56819.C: New test.
+
 2013-04-03  Tobias Burnus  <burnus@net-b.de>
 
        Backport from mainline:
diff --git a/gcc/testsuite/g++.dg/debug/pr56819.C b/gcc/testsuite/g++.dg/debug/pr56819.C
new file mode 100644 (file)
index 0000000..62926be
--- /dev/null
@@ -0,0 +1,27 @@
+// PR debug/56819
+// { dg-do compile }
+// { dg-options "-fcompare-debug" }
+
+template <typename>
+struct A
+{
+  template <typename>
+  struct B;
+};
+
+template <typename>
+struct C
+{
+  typedef int I;
+};
+
+template <typename T>
+class D
+{
+  typedef A <void> E;
+  typedef typename T::template B <E> F;
+  typedef typename C <F>::I I;
+  A <I> foo () { return A<I> (); }
+};
+
+template class D <A <void> >;