Because of the way the Go frontend handles call expressions with multiple results, it's possible for expressions to be flattened more than once. In the case of Slice_construction_expression, allocating the slice storage multiple times caused a compiler crash as one of the Temporary_statement's wound up not getting a backend expression. This patch fixes the problem.
The test case for this is https://golang.org/cl/34020. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian
Index: gcc/go/gofrontend/MERGE =================================================================== --- gcc/go/gofrontend/MERGE (revision 243424) +++ gcc/go/gofrontend/MERGE (working copy) @@ -1,4 +1,4 @@ -08d221726e3f50cb197a931ba385fac67f66a028 +7a941ba323660ec7034cd92d4eab466024a3c72c The first line of this file holds the git revision number of the last merge done from the gofrontend repository. Index: gcc/go/gofrontend/expressions.cc =================================================================== --- gcc/go/gofrontend/expressions.cc (revision 243321) +++ gcc/go/gofrontend/expressions.cc (working copy) @@ -12951,8 +12951,8 @@ Slice_construction_expression::do_flatte // Base class flattening first this->Array_construction_expression::do_flatten(gogo, no, inserter); - // Create an stack-allocated storage temp if storage won't escape - if (!this->storage_escapes_) + // Create a stack-allocated storage temp if storage won't escape + if (!this->storage_escapes_ && this->slice_storage_ == NULL) { Location loc = this->location(); this->array_val_ = create_array_val();