This patch by Chris Manghane fixes a compiler crash when copying an
empty composite literal.  This fixes GCC PR 61264.  Bootstrapped and
ran Go testsuite on x86_64-unknown-linux-gnu.  Committed to mainline.

Ian
diff -r 22a19b12e472 go/expressions.cc
--- a/go/expressions.cc Tue Dec 16 10:50:55 2014 -0800
+++ b/go/expressions.cc Tue Dec 16 11:12:37 2014 -0800
@@ -11588,7 +11588,10 @@
   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 @@
   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());
   }
 

Reply via email to