diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-21 22:59:31 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-21 22:59:31 +0000 |
commit | 91ab22083add8122bdc79155ae1de0b5392f88ff (patch) | |
tree | 65b3ae81ddafea533e13985184ff0f350c356560 | |
parent | e0cb7e1ef4a76a9e65d023fa380f7d3525a66443 (diff) | |
download | gcc-91ab22083add8122bdc79155ae1de0b5392f88ff.zip gcc-91ab22083add8122bdc79155ae1de0b5392f88ff.tar.gz gcc-91ab22083add8122bdc79155ae1de0b5392f88ff.tar.bz2 |
Don't crash indexing into erroneous array.
From-SVN: r168142
-rw-r--r-- | gcc/go/gofrontend/expressions.cc | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc index 0745704..5cd9e66 100644 --- a/gcc/go/gofrontend/expressions.cc +++ b/gcc/go/gofrontend/expressions.cc @@ -9154,7 +9154,11 @@ Array_index_expression::do_get_tree(Translate_context* context) source_location loc = this->location(); Array_type* array_type = this->array_->type()->array_type(); - gcc_assert(array_type != NULL); + if (array_type == NULL) + { + gcc_assert(this->array_->type()->is_error_type()); + return error_mark_node; + } tree type_tree = array_type->get_tree(gogo); if (type_tree == error_mark_node) |