diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-23 00:07:42 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-23 00:07:42 +0000 |
commit | 62d1a8f9040b90d1503a5495cf43b80027add792 (patch) | |
tree | d298f10e950aea64f084a93659f26bdea02f0397 | |
parent | 7838059fb2e20689a98ece0f077ed288146515b6 (diff) | |
download | gcc-62d1a8f9040b90d1503a5495cf43b80027add792.zip gcc-62d1a8f9040b90d1503a5495cf43b80027add792.tar.gz gcc-62d1a8f9040b90d1503a5495cf43b80027add792.tar.bz2 |
Avoid crash when an unknown object is declared as a type.
From-SVN: r168188
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index ea5821b..8592ef5 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -1248,14 +1248,20 @@ Unknown_expression::do_lower(Gogo*, Named_object*, int) { source_location location = this->location(); Named_object* no = this->named_object_; - Named_object* real = no->unknown_value()->real_named_object(); - if (real == NULL) + Named_object* real; + if (!no->is_unknown()) + real = no; + else { - if (this->is_composite_literal_key_) - return this; - error_at(location, "reference to undefined name %qs", - this->named_object_->message_name().c_str()); - return Expression::make_error(location); + real = no->unknown_value()->real_named_object(); + if (real == NULL) + { + if (this->is_composite_literal_key_) + return this; + error_at(location, "reference to undefined name %qs", + this->named_object_->message_name().c_str()); + return Expression::make_error(location); + } } switch (real->classification()) { |