diff mbox

[gccgo] Avoid crash on error

Message ID mcreibhx4xo.fsf@google.com
State New
Headers show

Commit Message

Ian Lance Taylor Oct. 22, 2010, 10:01 p.m. UTC
This gccgo patch avoids a crash when generating the type descriptor of
an erroneous type.  Committed to gccgo branch.

Ian
diff mbox

Patch

diff -r bbbe54463c27 go/gogo-tree.cc
--- a/go/gogo-tree.cc	Fri Oct 22 14:31:46 2010 -0700
+++ b/go/gogo-tree.cc	Fri Oct 22 15:00:13 2010 -0700
@@ -2558,6 +2558,11 @@ 
 						name->in_function());
   tree id = get_identifier_from_string(decl_name);
   tree descriptor_type_tree = initializer->type()->get_tree(this);
+  if (descriptor_type_tree == error_mark_node)
+    {
+      *pdecl = error_mark_node;
+      return;
+    }
   tree decl = build_decl(name == NULL ? BUILTINS_LOCATION : name->location(),
 			 VAR_DECL, id,
 			 build_qualified_type(descriptor_type_tree,