OSDN Git Service

Avoid some crashes on erroneous programs.
authorian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Dec 2010 23:56:47 +0000 (23:56 +0000)
committerian <ian@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 9 Dec 2010 23:56:47 +0000 (23:56 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@167670 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/go/gofrontend/expressions.cc
gcc/go/gofrontend/types.cc

index 0387ee4..022f5ce 100644 (file)
@@ -1146,7 +1146,11 @@ Func_expression::get_tree_without_closure(Gogo* gogo)
     }
 
   Named_object* no = this->function_;
-  tree id = this->function_->get_id(gogo);
+
+  tree id = no->get_id(gogo);
+  if (id == error_mark_node)
+    return error_mark_node;
+
   tree fndecl;
   if (no->is_function())
     fndecl = no->func_value()->get_or_make_decl(gogo, no, id);
@@ -1155,6 +1159,9 @@ Func_expression::get_tree_without_closure(Gogo* gogo)
   else
     gcc_unreachable();
 
+  if (fndecl == error_mark_node)
+    return error_mark_node;
+
   return build_fold_addr_expr_loc(this->location(), fndecl);
 }
 
index b030a42..8d440a8 100644 (file)
@@ -6864,6 +6864,8 @@ Named_type::do_get_tree(Gogo* gogo)
          t = make_node(RECORD_TYPE);
          this->named_tree_ = t;
          t = this->type_->interface_type()->fill_in_tree(gogo, t);
+         if (t == error_mark_node)
+           return error_mark_node;
        }
       break;