aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2011-03-03 01:39:25 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2011-03-03 01:39:25 +0000
commit86620d2d5fd57d0f7696dd74635f38248515c014 (patch)
treed592470510d93d3a22a612787d0b639183650d92 /gcc
parentdeed2020853b84c7bc74611ae7299cca5f2b63c8 (diff)
downloadgcc-86620d2d5fd57d0f7696dd74635f38248515c014.zip
gcc-86620d2d5fd57d0f7696dd74635f38248515c014.tar.gz
gcc-86620d2d5fd57d0f7696dd74635f38248515c014.tar.bz2
Don't crash on erroneous void initializer in temporary statement.
From-SVN: r170635
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/statements.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/go/gofrontend/statements.cc b/gcc/go/gofrontend/statements.cc
index c87574d..f8f54c4 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;