summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2014-12-16 19:14:54 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2014-12-16 19:14:54 +0000
commit6a85804bf7b5aaf3288995fd6157af907c4d6ab1 (patch)
treeb4dfcdc1bd29146c32195bc067c7a67c31f79cd9
parent8c54c36bdf845cce69641c012e97ef30dc497369 (diff)
downloadgcc-6a85804bf7b5aaf3288995fd6157af907c4d6ab1.tar.gz
re PR go/61264 (gccgo: ICE in __normal_iterator [GoSmith])
PR go/61264 compiler: Fix copying behavior for empty composite literals. From-SVN: r218789
-rw-r--r--gcc/go/gofrontend/expressions.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index f6d43811e16..9f68f77dc47 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -11588,7 +11588,10 @@ class Struct_construction_expression : public Expression
do_copy()
{
Struct_construction_expression* ret =
- new Struct_construction_expression(this->type_, this->vals_->copy(),
+ new Struct_construction_expression(this->type_,
+ (this->vals_ == NULL
+ ? NULL
+ : this->vals_->copy()),
this->location());
if (this->traverse_order_ != NULL)
ret->set_traverse_order(this->traverse_order_);
@@ -12353,7 +12356,10 @@ class Map_construction_expression : public Expression
Expression*
do_copy()
{
- return new Map_construction_expression(this->type_, this->vals_->copy(),
+ return new Map_construction_expression(this->type_,
+ (this->vals_ == NULL
+ ? NULL
+ : this->vals_->copy()),
this->location());
}