aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@gcc.gnu.org>2018-07-12 04:18:48 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2018-07-12 04:18:48 +0000
commit2c81daeeb5456d3b588e2ad22b5ec098bea2d393 (patch)
treea59b85139c2d6eedc3ad0833e554d8535f68aa43 /gcc
parent9d196169ccd1ef30c80f3681c13f84c573f5cd52 (diff)
downloadgcc-2c81daeeb5456d3b588e2ad22b5ec098bea2d393.zip
gcc-2c81daeeb5456d3b588e2ad22b5ec098bea2d393.tar.gz
gcc-2c81daeeb5456d3b588e2ad22b5ec098bea2d393.tar.bz2
compiler: build a single backend type for type alias
A type alias and its underlying type are identical. Build a single backend type for them. Previously we build two backend types, which sometimes confuse the backend's type system. Also don't include type aliases into the list of named type declarations, since they are not named types. Reviewed-on: https://go-review.googlesource.com/123362 From-SVN: r262572
Diffstat (limited to 'gcc')
-rw-r--r--gcc/go/gofrontend/MERGE2
-rw-r--r--gcc/go/gofrontend/gogo.cc2
-rw-r--r--gcc/go/gofrontend/types.cc5
3 files changed, 7 insertions, 2 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE
index 7d5c0aa..a18e3f3 100644
--- a/gcc/go/gofrontend/MERGE
+++ b/gcc/go/gofrontend/MERGE
@@ -1,4 +1,4 @@
-ea7ac7784791dca517b6681a02c39c11bf136755
+267686fd1dffbc03e610e9f17dadb4e72c75f18d
The first line of this file holds the git revision number of the last
merge done from the gofrontend repository.
diff --git a/gcc/go/gofrontend/gogo.cc b/gcc/go/gofrontend/gogo.cc
index eb31aa2..c89785c 100644
--- a/gcc/go/gofrontend/gogo.cc
+++ b/gcc/go/gofrontend/gogo.cc
@@ -7604,7 +7604,7 @@ Named_object::get_backend(Gogo* gogo, std::vector<Bexpression*>& const_decls,
case NAMED_OBJECT_TYPE:
{
Named_type* named_type = this->u_.type_value;
- if (!Gogo::is_erroneous_name(this->name_))
+ if (!Gogo::is_erroneous_name(this->name_) && !named_type->is_alias())
type_decls.push_back(named_type->get_backend(gogo));
// We need to produce a type descriptor for every named
diff --git a/gcc/go/gofrontend/types.cc b/gcc/go/gofrontend/types.cc
index e5f84c5..07819e2 100644
--- a/gcc/go/gofrontend/types.cc
+++ b/gcc/go/gofrontend/types.cc
@@ -991,6 +991,11 @@ Type::get_backend(Gogo* gogo)
if (this->btype_ != NULL)
return this->btype_;
+ if (this->named_type() != NULL && this->named_type()->is_alias()) {
+ this->btype_ = this->unalias()->get_backend(gogo);
+ return this->btype_;
+ }
+
if (this->forward_declaration_type() != NULL
|| this->named_type() != NULL)
return this->get_btype_without_hash(gogo);