From: Ian Lance Taylor Date: Thu, 10 Feb 2011 19:01:25 +0000 (+0000) Subject: Don't crash on make of slice of erroneous type. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=26d061fc233db50e5b599a10d092dfed8417a023;p=gcc.git Don't crash on make of slice of erroneous type. From-SVN: r170019 --- diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc index 86efc3b28bc..16563bbdda9 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -4565,6 +4565,8 @@ Array_type::do_make_expression_tree(Translate_context* context, tree element_size_tree = TYPE_SIZE_UNIT(element_type_tree); tree value = this->element_type_->get_init_tree(gogo, true); + if (value == error_mark_node) + return error_mark_node; // The first argument is the number of elements, the optional second // argument is the capacity. @@ -4688,7 +4690,7 @@ Array_type::do_make_expression_tree(Translate_context* context, tree range = build2(RANGE_EXPR, sizetype, size_zero_node, max); tree space_init = build_constructor_single(array_type, range, value); - return build2(COMPOUND_EXPR, TREE_TYPE(space), + return build2(COMPOUND_EXPR, TREE_TYPE(constructor), build2(MODIFY_EXPR, void_type_node, build_fold_indirect_ref(value_pointer), space_init),