From 6997f6964e07daab9d2cb8a3a85a0cfe141ab350 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Tue, 7 Dec 2010 22:26:39 +0000 Subject: Don't crash on erroneous result variable. Fixes issue 1320. From-SVN: r167573 --- gcc/go/gofrontend/gogo-tree.cc | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'gcc/go') diff --git a/gcc/go/gofrontend/gogo-tree.cc b/gcc/go/gofrontend/gogo-tree.cc index 41e621e..09f0d7c 100644 --- a/gcc/go/gofrontend/gogo-tree.cc +++ b/gcc/go/gofrontend/gogo-tree.cc @@ -1550,14 +1550,18 @@ Function::build_tree(Gogo* gogo, Named_object* named_function) else if ((*p)->is_result_variable()) { tree var_decl = (*p)->get_tree(gogo, named_function); - if ((*p)->result_var_value()->is_in_heap()) + if (var_decl != error_mark_node + && (*p)->result_var_value()->is_in_heap()) { gcc_assert(TREE_CODE(var_decl) == INDIRECT_REF); var_decl = TREE_OPERAND(var_decl, 0); } - gcc_assert(TREE_CODE(var_decl) == VAR_DECL); - DECL_CHAIN(var_decl) = declare_vars; - declare_vars = var_decl; + if (var_decl != error_mark_node) + { + gcc_assert(TREE_CODE(var_decl) == VAR_DECL); + DECL_CHAIN(var_decl) = declare_vars; + declare_vars = var_decl; + } } } *pp = NULL_TREE; -- cgit v1.1