Avoid endless loop checking whether type is pointer.
authorIan Lance Taylor <ian@gcc.gnu.org>
Fri, 24 Dec 2010 00:33:49 +0000 (00:33 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Fri, 24 Dec 2010 00:33:49 +0000 (00:33 +0000)
From-SVN: r168221

gcc/go/gofrontend/types.cc
gcc/go/gofrontend/types.h

index 2278c9426ff81ef228079f2ed14298b81bc7cad1..6ea529717281a8105be9f71911724f63f8bea2d1 100644 (file)
@@ -6853,6 +6853,19 @@ Named_type::do_verify()
   return true;
 }
 
+// Return whether this type is or contains a pointer.
+
+bool
+Named_type::do_has_pointer() const
+{
+  if (this->seen_ > 0)
+    return false;
+  ++this->seen_;
+  bool ret = this->type_->has_pointer();
+  --this->seen_;
+  return ret;
+}
+
 // Return a hash code.  This is used for method lookup.  We simply
 // hash on the name itself.
 
index fea864a2e3b4c5f318575ed7f32fccc73ca1fdf6..cecf106e448d77333dc504d91c52a9a8f1f6662d 100644 (file)
@@ -2552,8 +2552,7 @@ class Named_type : public Type
   do_verify();
 
   bool
-  do_has_pointer() const
-  { return this->type_->has_pointer(); }
+  do_has_pointer() const;
 
   unsigned int
   do_hash_for_method(Gogo*) const;
@@ -2677,7 +2676,7 @@ class Forward_declaration_type : public Type
 
   bool
   do_has_pointer() const
-  { return this->base()->has_pointer(); }
+  { return this->real_type()->has_pointer(); }
 
   unsigned int
   do_hash_for_method(Gogo* gogo) const