diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-01-04 19:46:23 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2011-01-04 19:46:23 +0000 |
commit | 10d53f5d111984f56ca2420ec2485637e8da8e01 (patch) | |
tree | 1bc7a3a0f1a5cf4a6eae1918b2a400acee976e99 /gcc/go | |
parent | 79b4a34ad062d1c4e9effcc508e8b44d6d9b5075 (diff) | |
download | gcc-10d53f5d111984f56ca2420ec2485637e8da8e01.zip gcc-10d53f5d111984f56ca2420ec2485637e8da8e01.tar.gz gcc-10d53f5d111984f56ca2420ec2485637e8da8e01.tar.bz2 |
Don't crash initializing multiple vars from a single result function.
From-SVN: r168482
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index f64e5ee..013adac 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -8898,10 +8898,16 @@ Call_result_expression::do_type() // Call_expression::do_must_eval_in_order when there is an error. Call_expression* ce = this->call_->call_expression(); if (ce == NULL) - return Type::make_error_type(); + { + this->set_is_error(); + return Type::make_error_type(); + } Function_type* fntype = ce->get_function_type(); if (fntype == NULL) - return Type::make_error_type(); + { + this->set_is_error(); + return Type::make_error_type(); + } const Typed_identifier_list* results = fntype->results(); if (results == NULL) { @@ -8952,7 +8958,11 @@ Call_result_expression::do_get_tree(Translate_context* context) tree call_tree = this->call_->get_tree(context); if (call_tree == error_mark_node) return error_mark_node; - gcc_assert(TREE_CODE(TREE_TYPE(call_tree)) == RECORD_TYPE); + if (TREE_CODE(TREE_TYPE(call_tree)) != RECORD_TYPE) + { + gcc_assert(saw_errors()); + return error_mark_node; + } tree field = TYPE_FIELDS(TREE_TYPE(call_tree)); for (unsigned int i = 0; i < this->index_; ++i) { |