aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2015-06-26 16:33:41 -0400
committerJason Merrill <jason@gcc.gnu.org>2015-06-26 16:33:41 -0400
commitd15364ce85d30212914ad79f624e9d2236a9be64 (patch)
treee95d665c543b8b6186eed2d1e94cc2f44fa8c0b6 /gcc/cp
parent7457279bae2d1ba50848d95f5b927a599e194646 (diff)
downloadgcc-d15364ce85d30212914ad79f624e9d2236a9be64.zip
gcc-d15364ce85d30212914ad79f624e9d2236a9be64.tar.gz
gcc-d15364ce85d30212914ad79f624e9d2236a9be64.tar.bz2
re PR c++/66067 (tree check ICE: accessed elt 1 of tree_vec with 0 elts in write_template_args, at cp/mangle.c:2574)
PR c++/66067 * mangle.c (write_nested_name): Limit TYPENAME_TYPE handling to TYPE_DECLs. * mangle.c (write_template_args): Handle 0 length TREE_VEC. From-SVN: r225083
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/mangle.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 6324dff..452a6d9 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2015-06-26 Jason Merrill <jason@redhat.com>
+ PR c++/66067
+ * mangle.c (write_nested_name): Limit TYPENAME_TYPE handling to
+ TYPE_DECLs.
+ * mangle.c (write_template_args): Handle 0 length TREE_VEC.
+
PR c++/66654
* typeck2.c (digest_init_r): Only expect reshaping if the class is
aggregate.
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index c1a81fc..f4947c4 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -984,7 +984,8 @@ write_nested_name (const tree decl)
write_template_prefix (decl);
write_template_args (TI_ARGS (template_info));
}
- else if (TREE_CODE (TREE_TYPE (decl)) == TYPENAME_TYPE)
+ else if ((!abi_version_at_least (9) || TREE_CODE (decl) == TYPE_DECL)
+ && TREE_CODE (TREE_TYPE (decl)) == TYPENAME_TYPE)
{
tree name = TYPENAME_TYPE_FULLNAME (TREE_TYPE (decl));
if (TREE_CODE (name) == TEMPLATE_ID_EXPR)
@@ -2621,7 +2622,7 @@ write_template_args (tree args)
if (args)
length = TREE_VEC_LENGTH (args);
- if (args && TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC)
+ if (args && length && TREE_CODE (TREE_VEC_ELT (args, 0)) == TREE_VEC)
{
/* We have nested template args. We want the innermost template
argument list. */