]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
Don't crash on calling new with an erroneous type.
authorIan Lance Taylor <ian@gcc.gnu.org>
Tue, 21 Dec 2010 23:19:43 +0000 (23:19 +0000)
committerIan Lance Taylor <ian@gcc.gnu.org>
Tue, 21 Dec 2010 23:19:43 +0000 (23:19 +0000)
From-SVN: r168144

gcc/go/gofrontend/expressions.cc

index 5cd9e66c489aec602f3182a6c94ec3e72e5b8b90..faea908a3bbf9528855790565cddaad8fc3551f0 100644 (file)
@@ -10242,9 +10242,13 @@ tree
 Allocation_expression::do_get_tree(Translate_context* context)
 {
   tree type_tree = this->type_->get_tree(context->gogo());
+  if (type_tree == error_mark_node)
+    return error_mark_node;
   tree size_tree = TYPE_SIZE_UNIT(type_tree);
   tree space = context->gogo()->allocate_memory(this->type_, size_tree,
                                                this->location());
+  if (space == error_mark_node)
+    return error_mark_node;
   return fold_convert(build_pointer_type(type_tree), space);
 }