diff options
author | Ian Lance Taylor <iant@golang.org> | 2020-06-29 11:30:43 -0700 |
---|---|---|
committer | Giuliano Belinassi <giuliano.belinassi@usp.br> | 2020-08-17 13:15:26 -0300 |
commit | e43f33cbba499edeb82ce286f5df82b2e3fdd98b (patch) | |
tree | 2660cc92a8565c4fac01e3d30568d98d98c96c17 | |
parent | 7d5230ada669a4fb611845e8e4c700cc81ea8493 (diff) | |
download | gcc-e43f33cbba499edeb82ce286f5df82b2e3fdd98b.zip gcc-e43f33cbba499edeb82ce286f5df82b2e3fdd98b.tar.gz gcc-e43f33cbba499edeb82ce286f5df82b2e3fdd98b.tar.bz2 |
compiler: remove some erroneous code that was never run
The code accidentally called Type::type_descriptor rather than the
do_type_descriptor method. Calling Type::type_descriptor with a second
argument of NULL would always crash. Since that never happened,
it revealed that this code was never actually executed.
Fixes PR go/95970
Reviewed-on: https://go-review.googlesource.com/c/gofrontend/+/240477
-rw-r--r-- | gcc/go/gofrontend/MERGE | 2 | ||||
-rw-r--r-- | gcc/go/gofrontend/types.cc | 14 |
2 files changed, 6 insertions, 10 deletions
diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index fa37648..ecef604 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -d4dade353648eae4a1eaa1acd3e4ce1f7180a913 +30674246ef60ab74566a21f362a7de7a09b99955 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/types.cc b/gcc/go/gofrontend/types.cc index d6cd326..3459a33 100644 --- a/gcc/go/gofrontend/types.cc +++ b/gcc/go/gofrontend/types.cc @@ -11106,15 +11106,11 @@ Named_type::do_type_descriptor(Gogo* gogo, Named_type* name) { if (this->is_error_) return Expression::make_error(this->location_); - if (name == NULL && this->is_alias_) - { - if (this->seen_alias_) - return Expression::make_error(this->location_); - this->seen_alias_ = true; - Expression* ret = this->type_->type_descriptor(gogo, NULL); - this->seen_alias_ = false; - return ret; - } + + // We shouldn't see unnamed type aliases here. They should have + // been removed by the call to unalias in Type::type_descriptor_pointer. + // We can see named type aliases via Type::named_type_descriptor. + go_assert(name != NULL || !this->is_alias_); // If NAME is not NULL, then we don't really want the type // descriptor for this type; we want the descriptor for the |