aboutsummaryrefslogtreecommitdiff
path: root/gcc/go/gofrontend
diff options
context:
space:
mode:
authorIan Lance Taylor <iant@google.com>2012-03-01 05:14:10 +0000
committerIan Lance Taylor <ian@gcc.gnu.org>2012-03-01 05:14:10 +0000
commitce842ad6cdd96ec4475cd81b6258ae3c6c46f771 (patch)
tree58642681b007c2d8a419efeb1a3af019720fea3c /gcc/go/gofrontend
parentfc24bee911ea0d941ffcd8a25db91f417e303168 (diff)
downloadgcc-ce842ad6cdd96ec4475cd81b6258ae3c6c46f771.zip
gcc-ce842ad6cdd96ec4475cd81b6258ae3c6c46f771.tar.gz
gcc-ce842ad6cdd96ec4475cd81b6258ae3c6c46f771.tar.bz2
compiler: Avoid some compiler crashes on invalid code.
* go-gcc.cc (class Gcc_tree): Add set_tree method. (set_placeholder_pointer_type): When setting to a pointer to error, set to error_mark_node. From-SVN: r184684
Diffstat (limited to 'gcc/go/gofrontend')
-rw-r--r--gcc/go/gofrontend/expressions.cc2
-rw-r--r--gcc/go/gofrontend/parse.cc5
2 files changed, 4 insertions, 3 deletions
diff --git a/gcc/go/gofrontend/expressions.cc b/gcc/go/gofrontend/expressions.cc
index abcd593..39a162b 100644
--- a/gcc/go/gofrontend/expressions.cc
+++ b/gcc/go/gofrontend/expressions.cc
@@ -13878,7 +13878,7 @@ tree
Heap_composite_expression::do_get_tree(Translate_context* context)
{
tree expr_tree = this->expr_->get_tree(context);
- if (expr_tree == error_mark_node)
+ if (expr_tree == error_mark_node || TREE_TYPE(expr_tree) == error_mark_node)
return error_mark_node;
tree expr_size = TYPE_SIZE_UNIT(TREE_TYPE(expr_tree));
go_assert(TREE_CODE(expr_size) == INTEGER_CST);
diff --git a/gcc/go/gofrontend/parse.cc b/gcc/go/gofrontend/parse.cc
index df28d2b..1a9c153 100644
--- a/gcc/go/gofrontend/parse.cc
+++ b/gcc/go/gofrontend/parse.cc
@@ -3948,8 +3948,9 @@ Parse::return_stat()
++p)
{
Named_object* no = this->gogo_->lookup((*p)->name(), NULL);
- go_assert(no != NULL);
- if (!no->is_result_variable())
+ if (no == NULL)
+ go_assert(saw_errors());
+ else if (!no->is_result_variable())
error_at(location, "%qs is shadowed during return",
(*p)->message_name().c_str());
}