compiler: copy has_padding field from converted struct

Test case is https://golang.org/cl/162617.

Fixes https://gcc.gnu.org/PR89321

Change-Id: I56d63feb4a45dc297e03502d72e0fbf7b5bd16a4
Reviewed-on: https://go-review.googlesource.com/c/162618
Reviewed-by: Cherry Zhang <cherryyz@google.com>
diff --git a/go/types.cc b/go/types.cc
index e411456..9081af6 100644
--- a/go/types.cc
+++ b/go/types.cc
@@ -1003,6 +1003,16 @@
 	  ins.first->second.is_placeholder = false;
 	}
 
+      // We set the has_padding field of a Struct_type when we convert
+      // to the backend type, so if we have multiple Struct_type's
+      // mapping to the same backend type we need to copy the
+      // has_padding field.  FIXME: This is awkward.  We shouldn't
+      // really change the type when setting the backend type, but
+      // there isn't any other good time to add the padding field.
+      if (ins.first->first->struct_type() != NULL
+	  && ins.first->first->struct_type()->has_padding())
+	this->struct_type()->set_has_padding();
+
       return ins.first->second.btype;
     }