From: Jakub Jelinek Date: Wed, 3 Apr 2013 15:24:13 +0000 (+0200) Subject: re PR c++/56819 (ICE: SIGSEGV in int_cst_value (tree.h:4013) with -fcompare-debug) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=7349ed0585442aa54457ebdfc8c24b94080da2df;p=gcc.git re PR c++/56819 (ICE: SIGSEGV in int_cst_value (tree.h:4013) with -fcompare-debug) 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: r197420 --- diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 68bc51195cc..93a22730753 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,11 @@ +2013-04-03 Jakub Jelinek + + 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-02 Jason Merrill PR c++/56821 diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c index 580b6770ae7..5117319a708 100644 --- a/gcc/cp/tree.c +++ b/gcc/cp/tree.c @@ -1255,8 +1255,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); } @@ -1389,8 +1394,8 @@ strip_typedefs_expr (tree t) r = copy_node (t); for (i = 0; i < n; ++i) TREE_VEC_ELT (r, i) = (*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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index d871b6e5960..7e16812c071 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2013-04-03 Jakub Jelinek + + PR debug/56819 + * g++.dg/debug/pr56819.C: New test. + 2013-04-03 Richard Biener PR tree-optimization/56817 diff --git a/gcc/testsuite/g++.dg/debug/pr56819.C b/gcc/testsuite/g++.dg/debug/pr56819.C new file mode 100644 index 00000000000..62926be2fb0 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/pr56819.C @@ -0,0 +1,27 @@ +// PR debug/56819 +// { dg-do compile } +// { dg-options "-fcompare-debug" } + +template +struct A +{ + template + struct B; +}; + +template +struct C +{ + typedef int I; +}; + +template +class D +{ + typedef A E; + typedef typename T::template B F; + typedef typename C ::I I; + A foo () { return A (); } +}; + +template class D >;