diff options
author | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-07 22:26:39 +0000 |
---|---|---|
committer | Ian Lance Taylor <ian@gcc.gnu.org> | 2010-12-07 22:26:39 +0000 |
commit | 6997f6964e07daab9d2cb8a3a85a0cfe141ab350 (patch) | |
tree | 66e313b0a30a25798a97445014f8ae86500b83ad /gcc/go | |
parent | c658f0ceef83bd7858aceb21cd72a12079bec1aa (diff) | |
download | gcc-6997f6964e07daab9d2cb8a3a85a0cfe141ab350.zip gcc-6997f6964e07daab9d2cb8a3a85a0cfe141ab350.tar.gz gcc-6997f6964e07daab9d2cb8a3a85a0cfe141ab350.tar.bz2 |
Don't crash on erroneous result variable.
Fixes issue 1320.
From-SVN: r167573
Diffstat (limited to 'gcc/go')
-rw-r--r-- | gcc/go/gofrontend/gogo-tree.cc | 12 |
1 files changed, 8 insertions, 4 deletions
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; |