Go patch committed: Don't set btype_ field too early for an alias type

Message ID CAOyqgcV3ELHq2V1QqePDm4_QcB3bd9r-FjRbY5KOuOCsvW9N6w@mail.gmail.com
State New
Headers show
Series
  • Go patch committed: Don't set btype_ field too early for an alias type
Related show

Commit Message

Ian Lance Taylor July 17, 2018, 6:27 p.m.
This patch by Cherry Zhang fixes a problem in the Go frontend
introduced by https://golang.org/cl/123362.  A type's btype_ field
should not be set before named types are converted if it is a
placeholder.  For alias type, it iwas set too early.  That could
result in unresolved placeholders.  This patch fixes the problem.
Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu.  Committed
to mainline.

Ian

Patch

Index: gcc/go/gofrontend/MERGE
===================================================================
--- gcc/go/gofrontend/MERGE	(revision 262830)
+++ gcc/go/gofrontend/MERGE	(working copy)
@@ -1,4 +1,4 @@ 
-d6338c94e5574b63469c740159d064e89c6718bf
+38850073f25f9de4f3daa33d799def3a33c942ab
 
 The first line of this file holds the git revision number of the last
 merge done from the gofrontend repository.
Index: gcc/go/gofrontend/types.cc
===================================================================
--- gcc/go/gofrontend/types.cc	(revision 262830)
+++ gcc/go/gofrontend/types.cc	(working copy)
@@ -992,8 +992,10 @@  Type::get_backend(Gogo* gogo)
     return this->btype_;
 
   if (this->named_type() != NULL && this->named_type()->is_alias()) {
-    this->btype_ = this->unalias()->get_backend(gogo);
-    return this->btype_;
+    Btype* bt = this->unalias()->get_backend(gogo);
+    if (gogo != NULL && gogo->named_types_are_converted())
+      this->btype_ = bt;
+    return bt;
   }
 
   if (this->forward_declaration_type() != NULL