From: Jason Merrill Date: Mon, 2 May 2011 21:59: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=3533b943d1c7a7afec4f85750e2a463e277aa0d8;p=gcc.git re PR c++/40975 (ICE in copy_tree_r on array new) PR c++/40975 * tree-inline.c (copy_tree_r): Handle STATEMENT_LIST. From-SVN: r173273 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index da19a8f2b56..10d30a91eee 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2011-05-02 Jason Merrill + + PR c++/40975 + * tree-inline.c (copy_tree_r): Handle STATEMENT_LIST. + 2011-05-02 Simon Martin PR c/35445 diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 5da4a12d9ad..37776753ca3 100644 --- a/gcc/tree-inline.c +++ b/gcc/tree-inline.c @@ -4271,14 +4271,26 @@ copy_tree_r (tree *tp, int *walk_subtrees, void *data ATTRIBUTE_UNUSED) CONSTRUCTOR_ELTS (*tp)); *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; + } else if (TREE_CODE_CLASS (code) == tcc_type) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == tcc_declaration) *walk_subtrees = 0; else if (TREE_CODE_CLASS (code) == tcc_constant) *walk_subtrees = 0; - else - gcc_assert (code != STATEMENT_LIST); return NULL_TREE; }