Commit 7b8ec217 by Ian Lance Taylor

Don't crash checking for unexported self-referential pointer field.

From-SVN: r170017
parent a3fa23e4
......@@ -8052,9 +8052,9 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
const std::string& name,
std::vector<const Named_type*>* seen)
{
type = type->deref();
const Named_type* nt = type->named_type();
if (nt == NULL)
nt = type->deref()->named_type();
if (nt != NULL)
{
if (nt->is_unexported_local_method(gogo, name))
......@@ -8072,6 +8072,8 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
}
}
type = type->deref();
const Interface_type* it = type->interface_type();
if (it != NULL && it->is_unexported_method(gogo, name))
return true;
......@@ -8095,11 +8097,17 @@ Type::is_unexported_field_or_method(Gogo* gogo, const Type* type,
++pf)
{
if (pf->is_anonymous()
&& (!pf->type()->deref()->is_error_type()
&& !pf->type()->deref()->is_undefined()))
&& !pf->type()->deref()->is_error_type()
&& !pf->type()->deref()->is_undefined())
{
Named_type* subtype = pf->type()->deref()->named_type();
gcc_assert(subtype != NULL);
Named_type* subtype = pf->type()->named_type();
if (subtype == NULL)
subtype = pf->type()->deref()->named_type();
if (subtype == NULL)
{
// This is an error, but it will be diagnosed elsewhere.
continue;
}
if (Type::is_unexported_field_or_method(gogo, subtype, name, seen))
{
if (nt != NULL)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment