From: Jason Merrill Date: Thu, 5 May 2011 20:50:57 +0000 (-0400) Subject: re PR c++/40975 (ICE in copy_tree_r on array new) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=deb5046baa31e38ba18bf9bab2e0a5fa3cef6719;p=gcc.git re PR c++/40975 (ICE in copy_tree_r on array new) PR c++/40975 * tree-inline.c (copy_tree_r): Use copy_statement_list. (copy_statement_list): Don't recurse. * stor-layout.c (copy_self_referential_tree_r): Don't allow STATEMENT_LIST. From-SVN: r173451 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 93409300f43..297306e610e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2011-05-05 Jason Merrill + + PR c++/40975 + * tree-inline.c (copy_tree_r): Use copy_statement_list. + (copy_statement_list): Don't recurse. + * stor-layout.c (copy_self_referential_tree_r): Don't allow + STATEMENT_LIST. + 2011-05-05 Joseph Myers * config/rs6000/rs6000.c (rs6000_handle_option): Don't fall diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index 9ad0d0ae2f3..6d662377c6d 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -177,6 +177,9 @@ copy_self_referential_tree_r (tree *tp, int *walk_subtrees, void *data) else if (code == SAVE_EXPR) return error_mark_node; + else if (code == STATEMENT_LIST) + gcc_unreachable (); + return copy_tree_r (tp, walk_subtrees, data); } diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 49488d4158b..46855a12db2 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -662,8 +662,6 @@ copy_statement_list (tree *tp) for (; !tsi_end_p (oi); tsi_next (&oi)) { tree stmt = tsi_stmt (oi); - if (TREE_CODE (stmt) == STATEMENT_LIST) - copy_statement_list (&stmt); tsi_link_after (&ni, stmt, TSI_CONTINUE_LINKING); } } @@ -4271,19 +4269,9 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) *tp = new_tree; } else if (code == STATEMENT_LIST) - { - /* We used to just abort on STATEMENT_LIST, but we can run into them - with statement-expressions (c++/40975). */ - tree new_list = alloc_stmt_list (); - tree_stmt_iterator i = tsi_start (*tp); - tree_stmt_iterator j = tsi_last (new_list); - for (; !tsi_end_p (i); tsi_next (&i)) - { - tree stmt = tsi_stmt (i); - tsi_link_after (&j, stmt, TSI_CONTINUE_LINKING); - } - *tp = new_list; - } + /* We used to just abort on STATEMENT_LIST, but we can run into them + with statement-expressions (c++/40975). */ + copy_statement_list (tp); else if (TREE_CODE_CLASS (code) == tcc_type) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == tcc_declaration)