compiler: varargs slices do not escape in runtime

Also, don't try to allocate an empty slice on the stack, as it will
confuse the GCC backend.

Also add a few trivial style, code formatting, and debug output fixes.

Updates golang/go#17431

Change-Id: I6dfe34b0553f377e4f92ede934dcfa6222fe9dad
Reviewed-on: https://go-review.googlesource.com/40983
Reviewed-by: Than McIntosh <thanm@google.com>
diff --git a/go/expressions.cc b/go/expressions.cc
index 2e89466..af7b49c 100644
--- a/go/expressions.cc
+++ b/go/expressions.cc
@@ -9578,6 +9578,12 @@
 			       Type* varargs_type, size_t param_count,
                                Slice_storage_escape_disp escape_disp)
 {
+  // When compiling the runtime, varargs slices do not escape.  When
+  // escape analysis becomes the default, this should be changed to
+  // make it an error if we have a varargs slice that escapes.
+  if (gogo->compiling_runtime() && gogo->package_name() == "runtime")
+    escape_disp = SLICE_STORAGE_DOES_NOT_ESCAPE;
+
   if (this->varargs_are_lowered_)
     return;
 
@@ -10915,7 +10921,7 @@
       inserter->insert(temp);
       this->end_ = Expression::make_temporary_reference(temp, loc);
     }
-  if (cap!= NULL && !cap->is_variable())
+  if (cap != NULL && !cap->is_variable())
     {
       temp = Statement::make_temporary(NULL, cap, loc);
       inserter->insert(temp);
@@ -13132,10 +13138,12 @@
   this->Array_construction_expression::do_flatten(gogo, no, inserter);
 
   // Create a stack-allocated storage temp if storage won't escape
-  if (!this->storage_escapes_ && this->slice_storage_ == NULL)
+  if (!this->storage_escapes_
+      && this->slice_storage_ == NULL
+      && this->element_count() > 0)
     {
       Location loc = this->location();
-      this->array_val_ = create_array_val();
+      this->array_val_ = this->create_array_val();
       go_assert(this->array_val_);
       Temporary_statement* temp =
           Statement::make_temporary(this->valtype_, this->array_val_, loc);
@@ -13165,7 +13173,7 @@
 Slice_construction_expression::do_get_backend(Translate_context* context)
 {
   if (this->array_val_ == NULL)
-    this->array_val_ = create_array_val();
+    this->array_val_ = this->create_array_val();
   if (this->array_val_ == NULL)
     {
       go_assert(this->type()->is_error());
@@ -14722,7 +14730,7 @@
   ast_dump_context->ostream() << 
     (this->type_info_ == TYPE_INFO_ALIGNMENT ? "alignment" 
     : this->type_info_ == TYPE_INFO_FIELD_ALIGNMENT ? "field alignment"
-    : this->type_info_ == TYPE_INFO_SIZE ? "size "
+    : this->type_info_ == TYPE_INFO_SIZE ? "size"
     : this->type_info_ == TYPE_INFO_BACKEND_PTRDATA ? "backend_ptrdata"
     : this->type_info_ == TYPE_INFO_DESCRIPTOR_PTRDATA ? "descriptor_ptrdata"
     : "unknown");