compiler: remove some erroneous code that was never run
authorIan Lance Taylor <iant@golang.org>
Mon, 29 Jun 2020 18:30:43 +0000 (11:30 -0700)
committerIan Lance Taylor <iant@golang.org>
Mon, 29 Jun 2020 21:29:39 +0000 (14:29 -0700)
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

gcc/go/gofrontend/MERGE
gcc/go/gofrontend/types.cc

index fa3764891fbe70ac2a8ceee3d1debf20f0256bf1..ecef60400cc1a188591f56219cd03650686929b4 100644 (file)
@@ -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.
index d6cd326b2e290b344cd7b40efd7b0a8babfa4a78..3459a3357a39a7f3db235c718d6affe5a164e9a2 100644 (file)
@@ -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