From: Ian Lance Taylor Date: Thu, 3 Mar 2011 01:39:25 +0000 (+0000) Subject: Don't crash on erroneous void initializer in temporary statement. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=86620d2d5fd57d0f7696dd74635f38248515c014;p=gcc.git Don't crash on erroneous void initializer in temporary statement. From-SVN: r170635 --- diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc index c87574dff1c..f8f54c4dcd7 100644 --- a/gcc/go/gofrontend/statements.cc +++ b/gcc/go/gofrontend/statements.cc @@ -391,7 +391,10 @@ Temporary_statement::do_get_tree(Translate_context* context) { gcc_assert(this->decl_ == NULL_TREE); 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; return error_mark_node; @@ -423,11 +426,10 @@ Temporary_statement::do_get_tree(Translate_context* context) this->decl_ = decl; } - if (this->init_ != NULL) + if (init_tree != NULL_TREE) DECL_INITIAL(this->decl_) = Expression::convert_for_assignment(context, this->type(), - this->init_->type(), - this->init_->get_tree(context), + this->init_->type(), init_tree, this->location()); if (this->is_address_taken_) TREE_ADDRESSABLE(this->decl_) = 1;