Commit 86620d2d by Ian Lance Taylor

Don't crash on erroneous void initializer in temporary statement.

From-SVN: r170635
parent deed2020
...@@ -391,7 +391,10 @@ Temporary_statement::do_get_tree(Translate_context* context) ...@@ -391,7 +391,10 @@ Temporary_statement::do_get_tree(Translate_context* context)
{ {
gcc_assert(this->decl_ == NULL_TREE); gcc_assert(this->decl_ == NULL_TREE);
tree type_tree = this->type()->get_tree(context->gogo()); tree type_tree = this->type()->get_tree(context->gogo());
if (type_tree == error_mark_node) tree init_tree = (this->init_ == NULL
? NULL_TREE
: this->init_->get_tree(context));
if (type_tree == error_mark_node || init_tree == error_mark_node)
{ {
this->decl_ = error_mark_node; this->decl_ = error_mark_node;
return error_mark_node; return error_mark_node;
...@@ -423,11 +426,10 @@ Temporary_statement::do_get_tree(Translate_context* context) ...@@ -423,11 +426,10 @@ Temporary_statement::do_get_tree(Translate_context* context)
this->decl_ = decl; this->decl_ = decl;
} }
if (this->init_ != NULL) if (init_tree != NULL_TREE)
DECL_INITIAL(this->decl_) = DECL_INITIAL(this->decl_) =
Expression::convert_for_assignment(context, this->type(), Expression::convert_for_assignment(context, this->type(),
this->init_->type(), this->init_->type(), init_tree,
this->init_->get_tree(context),
this->location()); this->location());
if (this->is_address_taken_) if (this->is_address_taken_)
TREE_ADDRESSABLE(this->decl_) = 1; TREE_ADDRESSABLE(this->decl_) = 1;
......
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