Commit 10d53f5d by Ian Lance Taylor

Don't crash initializing multiple vars from a single result function.

From-SVN: r168482
parent 79b4a34a
...@@ -8898,10 +8898,16 @@ Call_result_expression::do_type() ...@@ -8898,10 +8898,16 @@ Call_result_expression::do_type()
// Call_expression::do_must_eval_in_order when there is an error. // Call_expression::do_must_eval_in_order when there is an error.
Call_expression* ce = this->call_->call_expression(); Call_expression* ce = this->call_->call_expression();
if (ce == NULL) if (ce == NULL)
{
this->set_is_error();
return Type::make_error_type(); return Type::make_error_type();
}
Function_type* fntype = ce->get_function_type(); Function_type* fntype = ce->get_function_type();
if (fntype == NULL) if (fntype == NULL)
{
this->set_is_error();
return Type::make_error_type(); return Type::make_error_type();
}
const Typed_identifier_list* results = fntype->results(); const Typed_identifier_list* results = fntype->results();
if (results == NULL) if (results == NULL)
{ {
...@@ -8952,7 +8958,11 @@ Call_result_expression::do_get_tree(Translate_context* context) ...@@ -8952,7 +8958,11 @@ Call_result_expression::do_get_tree(Translate_context* context)
tree call_tree = this->call_->get_tree(context); tree call_tree = this->call_->get_tree(context);
if (call_tree == error_mark_node) if (call_tree == error_mark_node)
return 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)); tree field = TYPE_FIELDS(TREE_TYPE(call_tree));
for (unsigned int i = 0; i < this->index_; ++i) for (unsigned int i = 0; i < this->index_; ++i)
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment