From c12ff9d8f0f20cd2de63de6f14b9f0330e7ceb66 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 27 Apr 2011 21:53:34 -0400 Subject: re PR c++/40975 (ICE in copy_tree_r on array new) PR c++/40975 * cp-tree.def (VEC_INIT_EXPR): Add third operand. * cp-tree.h (VEC_INIT_EXPR_NELTS): New. * cp-gimplify.c (cp_gimplify_expr) [VEC_INIT_EXPR]: Handle it. * tree.c (build_vec_init_expr): Handle getting pointer/nelts. (build_vec_init_elt): Don't expect an array type. (build_array_copy): Adjust. * init.c (perform_member_init): Adjust. (build_new_1): Use build_vec_init_expr. From-SVN: r173056 --- gcc/cp/init.c | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'gcc/cp/init.c') diff --git a/gcc/cp/init.c b/gcc/cp/init.c index 25beba8..883734f 100644 --- a/gcc/cp/init.c +++ b/gcc/cp/init.c @@ -506,7 +506,8 @@ perform_member_init (tree member, tree init) /* mem() means value-initialization. */ if (TREE_CODE (type) == ARRAY_TYPE) { - init = build_vec_init_expr (type, init); + init = build_vec_init_expr (type, init, NULL_TREE, + tf_warning_or_error); init = build2 (INIT_EXPR, type, decl, init); finish_expr_stmt (init); } @@ -541,7 +542,8 @@ perform_member_init (tree member, tree init) || same_type_ignoring_top_level_qualifiers_p (type, TREE_TYPE (init))) { - init = build_vec_init_expr (type, init); + init = build_vec_init_expr (type, init, NULL_TREE, + tf_warning_or_error); init = build2 (INIT_EXPR, type, decl, init); finish_expr_stmt (init); } @@ -2384,15 +2386,14 @@ build_new_1 (VEC(tree,gc) **placement, tree type, tree nelts, vecinit = build_tree_list_vec (*init); } init_expr - = build_vec_init (data_addr, - cp_build_binary_op (input_location, - MINUS_EXPR, outer_nelts, - integer_one_node, - complain), - vecinit, - explicit_value_init_p, - /*from_array=*/0, - complain); + = build_vec_init_expr (data_addr, + (explicit_value_init_p + ? void_type_node: vecinit), + cp_build_binary_op (input_location, + MINUS_EXPR, outer_nelts, + integer_one_node, + complain), + complain); /* An array initialization is stable because the initialization of each element is a full-expression, so the temporaries don't -- cgit v1.1