This patch to the Go frontend fixes a bug: if you take a slice of an array, you are in effect taking the address of the array, which in Go requires moving the array to the heap. Bootstrapped and ran Go testsuite on x86_64-unknown-linux-gnu. Committed to mainline.
Ian
diff -r b9df7566fd57 go/expressions.cc --- a/go/expressions.cc Thu Mar 31 09:10:10 2011 -0700 +++ b/go/expressions.cc Thu Mar 31 09:44:18 2011 -0700 @@ -9283,10 +9283,13 @@ // A slice of an array requires an addressable array. A slice of a // slice is always possible. - if (this->end_ != NULL - && !array_type->is_open_array_type() - && !this->array_->is_addressable()) - this->report_error(_("array is not addressable")); + if (this->end_ != NULL && !array_type->is_open_array_type()) + { + if (!this->array_->is_addressable()) + this->report_error(_("array is not addressable")); + else + this->array_->address_taken(true); + } } // Return whether this expression is addressable.