diff options
author | Jason Merrill <jason@redhat.com> | 2011-05-02 17:59:57 -0400 |
---|---|---|
committer | Jason Merrill <jason@gcc.gnu.org> | 2011-05-02 17:59:57 -0400 |
commit | 3533b943d1c7a7afec4f85750e2a463e277aa0d8 (patch) | |
tree | 26809dd38d501276be7efd8a1ae0006e22de0d4f /gcc/tree-inline.c | |
parent | 0a2cdfe6fdd3376e694a83b3229fa03d018dbfda (diff) | |
download | gcc-3533b943d1c7a7afec4f85750e2a463e277aa0d8.zip gcc-3533b943d1c7a7afec4f85750e2a463e277aa0d8.tar.gz gcc-3533b943d1c7a7afec4f85750e2a463e277aa0d8.tar.bz2 |
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
Diffstat (limited to 'gcc/tree-inline.c')
-rw-r--r-- | gcc/tree-inline.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/gcc/tree-inline.c b/gcc/tree-inline.c index 5da4a12..3777675 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; } |